Monday, May 20, 2013

Leaflet, ArcGIS Server Invalid SRS

I encoutered some problems with ArcGIS Server and Leaflet WMS api. Namely its because the API sends the "srs" parameter to ArcGIS server with the value EPSG3857 while ArcGIS server expects EPSG4326.

Basically these EPSG values refers to the spatial reference of the maps in which they are drawn, they are what determines where exactly the position is when you say a certain location like 1N 103E.

How can you discover this error? You can use firebug to trap what URL calls the webpage is calling the WMS server, then you paste the URLs into a new window there should be an xml telling you the error if there is any, if not then a picture with the portion of the map as specified in the URL should be displayed.

Found the solution in Google Groups bascially you need to setup the map upfront by stating what spatial reference it should use.
 e.g

var map=L.map('map',{crs:L.CRS.EPSG4326}).setView([51,0],13);

It's specified as a option to the map function.

No comments:

Post a Comment