[GIS] Leaflet with EPSG4326 Tile Layer (using maptiler.org)

gdalleaflettile-map-service

I have successfully been using Klokan Petr Pridal's MapTiler (http://maptiler.org ) to take GeoTiff files and create TMS tile pyramids for Leaflet (option #1 which projects to EPSG3857, also called Google Maps compatible Spherical Mercator).

But my source data is in EPSG 4326, so I am now using option #3 for WGS84 Plate Caree (Geodetic). I believe it is using gdal2tiles under the hood.

The issue I have is that I do not see any of these overlay tiles in Leaflet. Even though am being careful to make sure the map is created with the right CRS.

I have tried tuning TMS: false, and TMS: true. No luck.

One thing I see is that the numbering even for the top levels z/x/y is weird: (e.g. 0/1/2.png ). Should a Krakow, Poland map really be at coordinates: 5/35/24? or 10/1136/795?

With the Spherical Mercator I have 10/568/346!!!

Also, all the specs for TMS tile numbering that I have seen are only good for EPSG3857 (spherical Mercator) which I believe has bounds of _85/-85 lat. But EPSG4326 would go to 90. So what gives in the numbering?

var map;
var krakowLayer = null;
var mapOptions = {
    center: new L.LatLng(0, 0),
    zoom: 1,
    tms: true,
    crs: L.CRS.EPSG4326
};
    map = new L.Map('map', mapOptions);
    krakowLayer = new L.TileLayer("./tiles4326/{z}/{x}/{y}.png", { tms: false, opacity: 0.8 });

function addLayers() {
    var baseLayers = {
        "CloudMade": cloudLayer,
    };
    var overlays = {
        "Krakow Layer": krakowLayer
    };
    L.control.layers(baseLayers, overlays).addTo(map);
}

Best Answer

I think you should run maptiler again. Maptiler can project your data, you should take the first option in maptiler "Google Maps Compatible". It will project your data to EPSG:3857. In EPSG:4326 your data will look very warped, in EPSG:3857 won't have any problems with leaflet + you will be able it combine it with OSM, Google etc.

I don't remember if you need to set tms to true or false, try both.

Related Question