Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WMS getImageUrl Question #23

Open
k-taylor opened this issue Nov 9, 2018 · 2 comments
Open

WMS getImageUrl Question #23

k-taylor opened this issue Nov 9, 2018 · 2 comments

Comments

@k-taylor
Copy link

k-taylor commented Nov 9, 2018

In the getImageUrl the bounding bbox is using the pixel location (as appose to lat/lng) for the corner points in the URL. It's my understand that the WMS bounding box is suppose to be lat/lngs, am I miss understanding something?

When we made the following changes it worked with our wms server:
`
wmsParams.width = width
wmsParams.height = height

    const degNW = bounds.getNorthWest()
    const degSE = bounds.getSouthEast()

    const url = this._wmsUrl

    const bbox = (this._wmsVersion >= 1.3 && this._crs === L.CRS.EPSG4326 ?
        [degSE.lat, degNW.lng, degNW.lat, degSE.lng] :
        [degNW.lng, degSE.lat, degSE.lng, degNW.lat]).join(',')`
@oliverheilig
Copy link
Member

Hi,

i've verified the behaviour, and the implementation is correct. It's the same implemetation as in L.TileLayer.WMS. However the result is not what you may expect:

  1. The default map projection/crs for Leaflet is "Google Mercator" (EPSG:3857, image 1). All WMS layers are queried with this crs then, the code reprojects the map-bounds to this crs, and the WMS must support EPSG:3857.
  2. You can set the map crs to EPSG.4326 with (image 2)
    var map = L.map('map', { crs:L.CRS.EPSG4326 // test for Plate Carree projection });
    This means the map uses the 'EPSG:4326-projection' then, wich means all layers also must support EPSG:4326.
  3. You can set only the crs of the WMS-layer to EPSG:4326 and leave the map in Google Mecator (image 3). Then the bounds are not reprojected, it's effectively the same as in your code. But the result isn't really accurate. If the projection of the WMS image is different than the projection of the map, all individual pixels should be transformed, like here https://www.jasondavies.com/maps/raster/ . Leaflet just overlays the resulting image.

So the WMS layer works as expected, i've tested it with the meteosat WMS in the sample. But you should check if you can make your WMS "Google-Mercator" aware, because Leaflet cannot mash-up images from different projections accurately.

Google Mercator
image
Equirectangular
image
Google Mercator with Equirectangular Overlay
image

@k-taylor
Copy link
Author

k-taylor commented Nov 9, 2018

Thank you so much for your quick reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants