Reputation: 23
I'm starting with Leaflet and I'm trying make a example with custom projection (EPSG:23030) to show a layer from WMS service. If I do not know the resolutions, how can I make it? I have this code, using the plugin Proj4Leaflet, but it doesn't work:
var crs23030 = new L.Proj.CRS('EPSG:23030','+proj=utm +zone=30 +ellps=intl +units=m +no_defs');
var map = new L.Map('map', {
crs: crs23030
});
L.tileLayer.wms('http://www.juntadeandalucia.es/servicios/mapas/callejero/wms', {
layers: 'CallejeroCompleto',
format: 'image/jpeg',
maxZoom: 13,
minZoom: 0
}).addTo(map);
map.setView(new L.LatLng(37.24344,-4.23522), 7);
Upvotes: 0
Views: 2771
Reputation: 23
Ok, I understand you and I have tried this:
var crs23030 = new L.Proj.CRS('EPSG:23030','+proj=utm +zone=30 +ellps=intl +units=m +no_defs',
{
resolutions: [1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1, 0.5]
}
);
and it works. I have concluded that if I doesn't know the resolutions, I must put it aproximately.
Thanks
Upvotes: 0
Reputation: 10329
If resolutions/scales are left out, it will default to the ones used by Leaflet's spherical Mercator implementation, which most likely will be a very bad fit for other projections.
What resolutions you use depends on the underlying tile server:
Also note that for a tile cache, you must also provide the gridset's origin, or Leaflet's request will not align with the cache's grid.
Upvotes: 0