Skip to content

Coordinate conversions

mtbeek32 edited this page Jan 6, 2023 · 19 revisions

introduction

Coordinates in the GeoDMS can be converted between and within coordinate systems. 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

To convert vector data between different coordinate systems, geometric functions are available to convert e.g. Rijksdriehoekcoördinaten to LatLongWgs84 coordinates. You can also define your own conversion from one coordinate system to another using EPSG codes:

unit<upoint> rdc_base   : format = "EPSG:28992";
unitt<dpoint> wgs84_base : format = "EPSG:4326";

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

vector data to grid and vice versa

See Point 2 Grid and Grid 2 Point examples for how to convert vector data and grid data

conversions within a coordinate system

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:

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

attribute<point_rd>        geometry        (domain, polygon); attribute<point_rd_ipoint> geometry_ipoint (domain, polygon) := geometry[point_rd_ipoint]; attribute<point_rd_hectom> geometry_hectom (domain, 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 data, converting coordinates might result in unexpected lines in the visualisation, see the next example:

File:ConvertCoordinatesIssue.png

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

see also

Clone this wiki locally