Coordinate conversions

Coordinates in the GeoDMS can be converted between and within coordinate-system. This can be useful if:

  • your source data uses different coordinates as your project
  • you want to convert vector data to grids or vice versa
  • your coordinates need to be converted to integer coordinates for polygon operations
  • your want to simplify your geometry

between different coordinate systems

There are two options to convert vector-data between different coordinate systems:

  1. geometric functions are available to convert e.g. Rijksdriehoekcoördinaten to LatLongWgs84 coordinates.
  2. Use configured EPSG codes:
unit<upoint> rdc_base   : SpatialReference = "EPSG:28992";
unit<dpoint> wgs84_base : SpatialReference = "EPSG:4326";

parameter<rdc_base>    rdc_point   := point(390390, 111612, rdc_base);
parameter<wgs84_base> wgs84_point := convert(rdc_point, wgs84_base);

Until 8.7.0 the format property was used instead of SpatialReference.

conversions within a coordinate system

vector data to grid and vice versa

See point-2-grid and grid-2-point examples for how to convert vector-data to grid-data and vice versa.

vector data expressed in different values-unit

conversions within a coordinate system, for instance to integer coordinates or from meter to hectometer can be configured in two steps:

1) configure the new values-unit with an expression relating to the original values unit. 2) relate the coordinates with the value function

See the following example (default order of Y, X in point functions, see XY order):

unit<float32> m               := baseunit('m', float32), label = "meter";
unit<fpoint>  point_rd_base   : SpatialReference = "EPSG:28992";
unit<fpoint>  point_rd        := range(point_rd_base, point(300000[m],0[m]), point(625000[m],280000[m]));
unit<ipoint>  point_rd_ipoint := ipoint(point_rd);
unit<ipoint>  point_rd_hectom := //values unit for rijkdsriehoek coordinates in hectometers
  gridset(point_rd, point(100f, 100f, point_rd), point(0f, 0f, point_rd), ipoint);

attribute<point_rd>        geometry        (DomainUnit, polygon);
attribute<point_rd_ipoint> geometry_ipoint (DomainUnit, polygon) := geometry[point_rd_ipoint];
attribute<point_rd_hectom> geometry_hectom (DomainUnit, polygon) := geometry[point_rd_hectom];

The point_rd_ipoint && point_rd_hectom values units are configured based on the base unit of this coordinate system: point_rd (in meters).

The geometry_ipoint attribute results in an integer variant of the geometry coordinates. The geometry_hectom attribute results in coordinates in hectometer.

conversion issues

For polygon, converting coordinates might result in unexpected lines in the visualisation, see the next example:

This is related to the polygon data model, using artificial lines between rings. This issue can be solved by clean-polygon-geometry.

see also