2

I am using the esri-leaflet plugin to connect to an internally hosted ArcGIS Server. I have tried using a basemap or tilemap implementation but get the same results with both. The problem is that I am only seeing North America and South America with the same tile starting over again at the prime meridian. I can find the tiles for europe and Asia by looking at them on the arcgis server so I know they are there.

My ArcGIS Server (set up by someone long gone) is saying we are using spatial reference of 4326.

Leaflet Esri plugin states this -

Your map service must be published using the Web Mercator Auxiliary Sphere tiling scheme (WKID 102100/3857) and the default scale option used by Google Maps, Bing Maps and ArcGIS Online. Esri Leaflet will not support any other spatial reference for tile layers.

Am I able to use this Esri leaflet plugin or do I need the proj4Leaflet with a new CRS projection setting?

I think I am getting tripped up on the tiling scheme of this pre-existing ArcGis server and don't know how to get a leaflet 2D map to work with it.

Some example code -

var crs = L.CRS.EPSG4326;
var map = L.map("map").setView([1,1],1); //just picked a random spot. 
L.esri.tiledMapLayer({
  url: myUrl,
  crs:crs,
  minZoom:0,
  maxZoom:12
}).addTo(map);

1 Answer 1

4

Leaflet includes information about the WGS84 coordinate system generally, but you'll still need to provide information about the origin and levels of detail of your own cached service in order for it to draw correctly.

const myWGS84 = L.CRS.EPSG4326;

// the service metadata advertises the origin and resolutions
myWGS84.origin = [-180,90];
myWGS84.resolutions = [
  0.3515625,
  0.17578125,
  0.087890625
];


var map = L.map('map',{crs: myWGS84}).setView([45,-125], 0);

L.esri.tiledMapLayer({
  url: 'https://services.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer'
}).addTo(map); 

live demo

1
  • Wow! Thank you so much John Gravois! This is just what I needed. Providing the resolutions as you described has made Leaflet show both sides of the map! Thanks again!
    – spartikus
    Commented Mar 5, 2018 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.