Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert an EPSG coordinate to a latitude / longitude?

I have the following OpenGis data, which I want to convert to a latitude/longitude coordinate (as used by Google maps).

<address xmlns:gml="http://www.opengis.net/gml">
  <gml:Point srsName="urn:ogc:def:crs:EPSG::28992">
    <gml:pos>142629.0 523546.0</gml:pos>
  </gml:Point>
</address>

On the EPSG Registry, I found the origin position of EPSG:28992.

Latitude of natural origin      52°09'22.178"N
Longitude of natural origin     5°23'15.5"E
Scale factor at natural origin  0.9999079 unity
False easting                   155000 metre
False northing                  463000 metre

I've tried to using proj4js, but I can't figure out how to put this in a projection and how to get the required output.

I've also tried calculating it myself. But I have no idea what I'm doing here and nothing really made sense :(.

like image 982
Arnold Daniels Avatar asked Oct 16 '25 13:10

Arnold Daniels


1 Answers

Here's how to do it. Ordinarily, you could just transform from one projection to another if Proj4js already included the projection, like this:

proj4('EPSG:900913', 'EPSG:4326', [20.0, 30.0]);

However, EPSG:28992 isn't included in the standard library. To do it, you could add it by adding a new definition:

proj4.defs(
   "EPSG:28992", 
   "+proj=sterea +lat_0=52.15616055555555   +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000  +ellps=bessel  +towgs84=565.040,49.910,465.840,-0.40939,0.35971,-1.86849,4.0772 +units=m +no_defs"
);

Then you can just transform like so:

proj4('EPSG:28992', 'EPSG:4326', [142629.0, 523546.0]);

Which yields

[5.2041980699764325, 52.69918555556015]

On Google Maps

like image 172
Dave Shepard Avatar answered Oct 19 '25 06:10

Dave Shepard