This projection results in a conformal output, meaning the shape of small areas is preserved,
no matter the distance from the origin. But it is not equal area, meaning the area size increases heavily
when getting closer to North or South. The area size increases with the same amount on x and y axes,
so the relative shape remains almost the same.

Mercator projection is the oldest projection, and it is still widely used because it produces a rectangular map.

This projection is used in Google Maps because of its conformal output.

For military or measurements purposes the UTM projection is used (or variants). This splits the Earth into small
areas and computes the cartesian coordinates relative to each area.

Here we use Oblique Mercator projection. Its advantage over the normal Mercator is that you can set the tangent point
between the cylinder and the sphere to be anywhere on Earth. So you can set the center of the map to be close
to the area you want projected and be able to measure accurately the distances between points and lines.

The map deformation is minimal close to the center point and close to the "equator" line.

The advantage over the UTM projection is that it can also produce a global rectangular map, like Mercator,
which is great for viewing.

The disadvantage over Mercator is that it needs more processing power.

WGS84 is the ellipsoid aproximation of the Earth, with big radius of 6,378,137 m and small radius of 6,356,752.3 m.

The geographic coordinates expressed for this ellipsoid are widely used today in maps and gps coordinates.

It is the default standard for representing geographic coordinates.

The purpose of this module is to provide convertion from polar to cartesian coordinates, so you can
process the geographic data with the Simple Features API functions implemented in the geo module.

That module works only with cartesian coordinates, but most maps have polar coordinates.

The projection formulas are taken from lib_proj library and implemented in XQuery.

The parameters for center point and scale should be the same as for the initial forward projection,
otherwise you will get wrong results.

Parameters

lat-0 as xs:double

long-c as xs:double

k0 as xs:double

is the scale in the center point.

coords as element(geoproj-param:coord)

a sequence of nodes of type <coord><x>x</x><y>y</y></coord> in namespace "http://zorba.io/modules/geoproj-param" The coordinates are expressed in meters.

Returns

element(geoproj-param:latlong)*

a sequence of geographic coordinates in format <latlong><lat>latitude degree</lat><long>longitude degree</long></latlong> in namespace "http://zorba.io/modules/geoproj-param" Note that the longitude corresponds to the x coordinate, and the latitude to the y coordinate.

rad-to-deg#1

declare function geoproj:rad-to-deg($rad as xs:double) as xs:double

Convert angle from radians to degrees.

Parameters

rad as xs:double

value in radians

Returns

xs:double

value in degrees (-360, 360)

wgs84-to-omerc-gmlpos#4

declare function geoproj:wgs84-to-omerc-gmlpos($lat-0 as xs:double, $long-c as xs:double, $k0 as xs:double, $lat-long-degrees as element(geoproj-param:latlong)*) as element(gml:pos)*

The Oblique Mercator projection is like the standard Mercator projection, but you can choose the point of origin.

Specify the coordinates of the center point somewhere near the points being projected,
so the projection deformation is small.

The azimuth in the center point, alpha, is hardcoded to zero, so the true north is preserved.

This is a simplification of the standard Oblique Mercator projection.

Gamma, the azimuth of the rectified bearing of center line is also zero, calculated from alpha.

The radius of the Earth in WGS84 is 6378137 m.

Reverse flatening 298.257223563.

Eccentricity e 0.0818192.

Parameters

lat-0 as xs:double

long-c as xs:double

k0 as xs:double

is the scale in the center point. The scale will increase when going far to north and south. Use value 1 to get the true distances between points, in meters. At equator, the distance for 1 degree is aproximately 110 km.

lat-long-degrees as element(geoproj-param:latlong)

Returns

element(geoproj-param:coord)*

a sequence of x-y coordinates in format <coord><x>x</x><y>y</y></coord> in namespace "http://zorba.io/modules/geoproj-param" Note that the x coordinate corresponds to the longitude, and y coordinate to the latitude. The coordinates are expressed in meters. The coordinates are relative to the center point.