Reputation: 117
I am using MapBox and are hoping to present some data from an ArcGis WMS service. It seems to be working fine, except that the projections are all wrong. Mapbox takes in an URL for the service and adds querystring parameters based on the current map view, before sending it to the WMS service. It adds bbox=1115369.116737292,9392582.035682455,1134936.995978297,9412149.914923461 when it should have been something like: bbox=260427.3772,7137390.031000003,261695.991099999,7138611.94860001
I have written a function that overrides the wms Mapbox function, where I am can make adjustments, so all I need is the correct algorithm. It has to take zooming into account.
Upvotes: 0
Views: 646
Reputation: 117
As I was able to override the Mapbox function, I could add extra querystring parameters. A quick look at the ArcGis Export Map api (http://resources.esri.com/help/9.3/arcgisserver/apis/rest/export.html), I saw that bboxSR could do the trick. From the api help page:
bboxSR: The well-known ID of the spatial reference of the bbox. If the bboxSR is not specified, the bbox is assumed to be in the spatial reference of the map.
I was able to find the well-known ID (wkid) of the projection I was after by looking it up under: https://developers.arcgis.com/javascript/jshelp/pcs.html. 3857 is the wkid for the projection used by Mapbox. From there I just added
bboxSR=3857
to the querystring and it worked!
Upvotes: 0
Reputation: 28678
Have you tried setting the correct CRS in the L.TileLayer.WMS options? Included CRS's are L.CRS.EPSG3857 (default), L.CRS.EPSG4326 and L.CRS.EPSG3395. If what you need isn't there you could use the Proj4js plugin.
Upvotes: 0