-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Added support for different CRS for each L.TileLayer.WMS instance #945
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
Conversation
|
It there any interest in this feature? I think it is worth looking into (obviously), especially the reproject method in L.Map. |
|
This seems like a useful, easy addition to me. |
|
Waiting for this enhancement to be pulled in too. |
|
According to the roadmap, it seems like a rewrite of the CRS subsystem is underway. I hope this is pulled it into this process. |
|
Probably merging for 0.6, sorry that it took so long to review this pull! I had to postpone it because of planned CRS changes. |
|
Great news! Thanks for the feedback :-) |
|
@kengu finally did this one. I used your idea but wrote this in a slightly simpler way. Going to be included in 0.6 release. Thanks a lot again! |
|
Hurray! Thanks 👍 |
|
I made minor additions so I can use both WMS and OSM maps in baselayers. My other CRS is EPSG:3067. |
|
@mourner I'm a little confused on how to properly implement a TileLayer.WMS with a crs that differs from the map's crs. Currently i do have it working but, only with the addition of @mhotby 's modification. Without that, it seems impossible to implement. Was this not the point of your integration of the For example If i define two TileLayers as follows:
Define a map with the default, osm compatible crs of EPSG3857: With the configuration above all requests to the nycMap WMS server fail due to incorrect scale and or origin issues. However If i use the Now everything works as expected. I'm just wondering if this is what you intended or if i have missed something in my configuration. Also, if this is the correct way to implement it , why are mhotby 's mods not implemented along with the TileLayer.WMS.options.crs. It seems to be incomplete without them... Thanks for everything, leaflet is nothing short of awesome! |
|
@arctelix are you trying to mix more than one CRS on the same map? That has been discussed a couple of times, for example see #2553. My opinion on this is that CRS switching should not be supported by Leaflet core, since I can't see it working in an intuitive way. It could, however, probably quite easily be be supported by a plugin. So far, no one have written such a plugin, as far as I know. I was actually a bit surprised to learn about the WMS functionality added by this PR, since it seems to add at least partial support for multiple CRS! |
|
Thanks! |
This is a partial implementation of issue #942 which only affects L.TileLayer.WMS.
It turned out to be pretty easy to add support for different CRS for each L.TileLayer.WMS instance. I just had to add a small reproject method to L.Map which default to old algorithm in L.TileLayer.WMS.getTileUrl when L.TileLayer.WMS.option.crs (L.CRS instance) is not set (default: undefined). When set, L.Map.reproject uses this to reproject given point and zoom (L.Point) from L.Map.options.crs to given L.CRS (in this case L.TileLayer.WMS.options.crs is set, otherwise L.Map.options.crs as before).
Example usage
which force
EPSG:4326to be used in WMS requests instead ofEPSG:3857whichmapnow by default uses.