Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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);
}
share|improve this question
add comment

2 Answers 2

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.

share|improve this answer
1  
Sorry, But Spherical Mercator (3857) is where it looks warped. Yes it displays fine, numbering is fine. but the native imagery is in 4326, so gdal2tiles is warping it to 3857. Since Leaflet claims CRS 4326, I want to use it (there is a bug issue listed in github about this) –  Dr.YSG Jan 27 '13 at 2:07
add comment
up vote 0 down vote accepted

I was able to solve this by not using maptiler. I have a copy of SAFE FME, and I used it's ll84 SLIPPY tile generator (WebMapTiler) to create the tiles.

You can see my results in this post:

Leaflet and EPSG 4326 Projections

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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