2

I've been having issues getting this to work correctly. Some details:

  • I need to use Leaflet 1.0 or higher
  • The map is BlueMarble ShadedRelief Bathymetry from NASA GIBS
  • The map is EPSG:4326
  • The map is loaded via TMS as opposed to WMS

Here's the closest I've gotten so far.

It seems to load and tile everything correctly, but some of the map isn't loading. Everything east of like 180 Longitude, and everything south of like -50 Latitude. I'm basing the code on the example on NASA's site, which works well (I got it working myself), but relies on an older version of Leaflet. After upgrading to a newer version, I've just run into a series of issues. I'm hoping someone can help me finally sort this out.

1 Answer 1

0

Your current code looks like:

        map = L.map("map", {
            center: [0, 0],
            zoom: 2,
            maxZoom: 8,
            maxBounds: [
                [-89.9999, -179.9999],
                [89.9999, 179.9999]
            ]
        });
...
        var crs = new L.Proj.CRS(
            "EPSG:4326",
            ....)
....
        var layer = L.tileLayer(template, {
            crs: crs,
            ....}

If you pay attention to the Leaflet API reference, you'll notice that L.TileLayers do not have a crs option, and that L.Maps do have a crs option.

See also the "Notes to GIS users of WMS services" section of the Leaflet tutorial on WMS, as it contains an obvious example of a map with EPSG:4326 CRS.

6
  • I took a look at the example wh.nerdfighteria.info/_views/timeline/maptest.php now, and all the mistakes are commented out. Code is correct now but still no map is shown. When I looked at the network traffic I saw server returning status 301 for tile requests. Detailed look in Fiddler showed that server requires https requstest. So server template definition should start with "https://". I tested it and it works.
    – TomazicM
    Commented Jan 26, 2018 at 16:51
  • Few minutes later: initial map shows OK, but when zooming tiles are all over the place.
    – TomazicM
    Commented Jan 26, 2018 at 17:16
  • Another few minutes later: when option tms:true is removed from layer definition, it finally really works. Appologies for littering.
    – TomazicM
    Commented Jan 26, 2018 at 17:32
  • Thanks Ivan for the suggestions, that definitely improved things although I'm still working out a few issues. And yeah, TomazicM, I've been working on it right now which is why things are constantly changing. Right now I just can't get the southernmost and easternmost regions to appear. I've been messing around with Bounds and MaxBounds but haven't fixed it yet. Commented Jan 26, 2018 at 17:49
  • The following options are missing in layer definition: noWrap: true, continuousWorld: true,
    – TomazicM
    Commented Jan 26, 2018 at 18:31

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.