ptv-logistics / Leaflet.NonTiledLayer

A leaflet layer for non-tiled overlays.
https://ptv-logistics.github.io/Leaflet.NonTiledLayer/
ISC License
59 stars 19 forks source link

Issue when using EPSG4326 Projection #5

Closed gaubert closed 8 years ago

gaubert commented 8 years ago

I could use your NonTiledLayer with the default projection EPSG3857 but when I change it in the map creation to L.CRS.EPSG4326, I get a distorted image.

Here is a screenshot calling the WMS with Tiled layer: https://www.dropbox.com/s/bnsau2s5nvhubwq/LeafletTiled-4326.png?dl=0

Here is the screenshot with the NonTiledWMSLayer: https://www.dropbox.com/s/deqxzzzwi50vpt2/LeafletNonTiled-4326.png?dl=0

I get a bad height (and width ?) for the image in the WMS request ? there it is: http://eumetview.eumetsat.int/geoserv/wms?service=WMS&request=GetMap&version=1.3.0&layers=meteosat%3Anatural&styles=&format=image%2Fpng8&transparent=true&maxZoom=8&crs=EPSG%3A4326&time=2015-11-27T09%3A30%3A00.000Z&width=1904&height=383&bbox=-167.34375,-33.75,167.34375,33.57421875

Beware the images are only kept for 3 days.

Just in case the quikc and dirty source code is here: https://github.com/gaubert/mapivor/blob/master/mapivor-server/eumetview.js

look for the draw_map function which is creating all the layers.

Any idea why the computed height is so small ?

Why does it work for the tiled version ?

Any lead would be great.

Thanks

oliverheilig commented 8 years ago

Hi,

cannot reproduce it with this sample when changing the crs of the map.

Oliver

gaubert commented 8 years ago

Hi,

yes it is when I put precisely crs: L.CRS.EPSG4326 that I get the distorted image. Zoom level was 0. I am using 1.0beta2

See this source file in the history https://github.com/gaubert/mapivor/blob/e901d9c5d6042ef0f7a4824f6606f0e0d61bcd37/mapivor-server/eumetview.js

I am now using leaflet.wms but I preferred your simple solution.

Let me know if you need more information.

Thanks.

oliverheilig commented 8 years ago

Can reproduce it. I think the problem ist that this layer has restricted bounds. NonTiledLayer doesn't support this. I could add a bounds property, but you would have to explicitly set it in code. I think in this case Leaflet.wms may be the better solution, i guess it makes a GetCapabilities request and sets the bounds accordingly.

my code:

    new L.NonTiledLayer.WMS("http://eumetview.eumetsat.int/geoserv/wms", {
        maxZoom: 8,
        minZoom: 0,
        layers: 'meteosat:airmass',
        transparent: true,
        version: '1.3.0',
        attribution: "EUMETSAT 2015",
        opacity: 0.5
    }).addTo(map);

Bounds for http://eumetview.eumetsat.int/geoserv/wms?Request=GetCapabilities

<EX_GeographicBoundingBox> 
    <westBoundLongitude>-90.0019140328881</westBoundLongitude>
    <eastBoundLongitude>89.9725637543488</eastBoundLongitude>
    <southBoundLatitude>-70.9390024925306</southBoundLatitude>
    <northBoundLatitude>71.0577423098384</northBoundLatitude>
</EX_GeographicBoundingBox>

Oliver

oliverheilig commented 8 years ago

OK, i've added a bounds option to the layer, this should do it, see http://ptv-logistics.github.io/Leaflet.NonTiledLayer/. But you have to set it by code, there is no automatic initialization using GetCapabilities.

    // insert airmass layer
    var airmass = new L.NonTiledLayer.WMS("http://eumetview.eumetsat.int/geoserv/wms", {
        maxZoom: 8,
        minZoom: 0,
        layers: 'meteosat:airmass',
        transparent: true,
        version: '1.3.0',
        attribution: "EUMETSAT 2015",
        opacity: 0.75,
        pane: 'tilePane',
        zIndex: 50,
        bounds: L.latLngBounds([-90.0019140328881, -70.9390024925306], [89.9725637543488, 71.0577423098384])
    }).addTo(map);
gaubert commented 8 years ago

Thanks @oliverheilig for the fix. Ok got it, it was because of the bounded map. I can set the bounds. I am already doing the getCapability myself. Many thanks I will test it.

oliverheilig commented 8 years ago

Hi,

just checked it with EPGS:4326 and found another issue with the order of the coordinates for bbox and WMS ver, 1.3. Now using the Leaflet implementation for building the bbox. It now works with all combinations of WMS and CRS.

oliverheilig commented 8 years ago

Seems to be ok now in all cases. Closing it.

gaubert commented 8 years ago

Yes this is fine. Thanks

Boeblahoebla commented 9 months ago

OK, i've added a bounds option to the layer, this should do it, see http://ptv-logistics.github.io/Leaflet.NonTiledLayer/. But you have to set it by code, there is no automatic initialization using GetCapabilities.

    // insert airmass layer
    var airmass = new L.NonTiledLayer.WMS("http://eumetview.eumetsat.int/geoserv/wms", {
        maxZoom: 8,
        minZoom: 0,
        layers: 'meteosat:airmass',
        transparent: true,
        version: '1.3.0',
        attribution: "EUMETSAT 2015",
        opacity: 0.75,
        pane: 'tilePane',
        zIndex: 50,
        bounds: L.latLngBounds([-90.0019140328881, -70.9390024925306], [89.9725637543488, 71.0577423098384])
    }).addTo(map);

Hi

Just wanted to chime in here, as I was looking into something...

Just checked the page you mentioned... IF you look at the page now the tiles are all completely messed up. It's like the image consists of tiles coming form another timestamp or location.

If you start zooming in & out, the tiles start to change to either a random timestamp or location. Don't know what is wrong, but it seems the EuMETSAT implementation doesn't work anymore with the current library.

Any advice on this?

oliverheilig commented 9 months ago

Yes, looks like the image is messed-up, both as tilelayer and with single tile. Maybe need some other free WMS, or just remove it.

Boeblahoebla commented 9 months ago

I have sent an email to EuMETSAT about this as not only leaflet but also maplibre, osm & mapbox h1ve similar issues.

It's probably due to an update which happened on the GeoServer on EuMERSAT's end that requires us to consult it differently.

I'll keep you posted