Search code examples
reactjsazureazure-mapsepsg

EPSG:3857 coordinates system compatibility with Azure Maps


Is EPSG:3857 coordinates system compatibility with Azure Maps? I am working on some project which require a geoJson to be loaded over the Azure maps but its not able to identify the coordinates correctly. The same geoJson is producing desired output on the other map provider like qGIS and Ordenance Survey.


Solution

  • EPSG:3857 is used by the rendering engine under the hood for the map, but like most other web map SDKs, the data input needs to be in EPSG:4326. Note that the specification for GeoJSON requires coordinates to be in EPSG:4326. Using other coordinates would make the GeoJSON file invalid and not inline with the specification.

    That said, the math library in Azure Maps does provide calculations for converting coordinates between EPSG:3857 (web Mercator) and EPSG:4326 (WGS 84).

    https://learn.microsoft.com/en-us/javascript/api/azure-maps-control/atlas.math?view=azure-maps-typescript-latest#mercatorPixelsToPositions_Pixel____number_

    https://learn.microsoft.com/en-us/javascript/api/azure-maps-control/atlas.math?view=azure-maps-typescript-latest#mercatorPositionsToPixels_Position____number_