wp-plugin-leaflet-map icon indicating copy to clipboard operation
wp-plugin-leaflet-map copied to clipboard

support for WMS

Open pktrigg opened this issue 7 years ago • 12 comments

Evening

just wondering if your leaflet plugin for WP supports a reference to a WMS (Web Map Service)?

regards pk

pktrigg avatar May 27 '18 11:05 pktrigg

Nope, but it looks like I should add this!

https://leafletjs.com/examples/wms/wms.html

Thanks for the heads up!

bozdoz avatar May 28 '18 12:05 bozdoz

indeed. Many thanks for getting back to me. I am still trying to sort this one out. I tried out OSM without luck.
I prefer Leaflet anyhow.

are you active on this project?

cheers pk

pktrigg avatar May 28 '18 12:05 pktrigg

I'm on and off, depending on when I find an issue I'd find easy or worthwhile to tackle. This one seems like it could be easy, but I'm unsure at the moment how I would implement it. Would you expect a WMS to be alone on a map, or be on top of a basemap?

bozdoz avatar May 28 '18 12:05 bozdoz

Think I'm going to have to bump this again. I'm still unsure of how to implement this. I'm thinking it could be similar in nature to the layer control issue: #43

I'm not sure how easy it would be to do something like that though. I might need to stop assuming one basemap, stop assuming it would be openstreetmap, for example... I was thinking adding a name attribute to all shortcodes, to identify them in a layer control:

[leaflet-map]
[leaflet-layer name="OSM" src="osm.org/{x}/{y}/{z}"]
[leaflet-wms name="Another basemap" src="./wms/src/"]
[leaflet-marker name="Home"]
[leaflet-geojson name="Anonymous shapes" src="github.com/geo.json"]

Another idea might be to nest shortcodes, but I haven't had much experience trying something like that. Maybe another shortcode which gathers previously named layers:

[leaflet-control basemaps="OSM, Another basemap" layers="Home, Anonymous shapes"]

I'm not sure how easy that is to do with basemaps still, assuming we will typically force a default basemap.

bozdoz avatar Sep 25 '18 02:09 bozdoz

That would be an awesome addition to the plugin.

One way I would see it would be to have a base/overlay parameter to each layer, which could control in which group they show up in the Layer Control... The name parameter would be the label in the Layer Control and the Type would decide whether they show up in either the base group or the overlays...

[leaflet-map]
[leaflet-layer name="OSM" type="base" src="osm.org/{x}/{y}/{z}"]
[leaflet-wms name="Another basemap" type="base" src="./wms/src/"]
[leaflet-marker name="Home" type="overlay"]
[leaflet-geojson name="Anonymous shapes" type="overlay" src="github.com/geo.json"]

jmarchand-jive avatar Nov 06 '18 16:11 jmarchand-jive

Just thinking specific to this issue, it may make more sense to add an attribute to the map to omit the basemap, then add the WMS layers/any other:

[leaflet-map noBasemap]
[leaflet-wms src="./wms/src/"]

I'm merely assuming that the basemap might be an issue. I should think about solving the base/overlay control issue separately (#43)

bozdoz avatar Nov 06 '18 18:11 bozdoz

Yes, that might work. But, at least in my case, I would ideally have 2-3 wms containing different informations and would like the user to be able to toggle between one and the others (while keeping the overlays - geojson files - visible).

I understand that it might not be possible now, but would be awesome to have!

jmarchand-jive avatar Nov 06 '18 19:11 jmarchand-jive

This would be an awesome addition, any news?

arteteco avatar Dec 05 '20 09:12 arteteco

What is your use case @arteteco ? Trying to get a feel as to what is needed before beginning anything.

bozdoz avatar Dec 08 '20 23:12 bozdoz

Hi @bozdoz , I could imagine 2 scenarios for me: in one, I have a map that I serve via WMS and I want a front end to show it. In another I may want to collect WMSs relevant to data I already have, so that users can easily overlay them.

For example, I may have a collection of points where a certain plant was found, and I'd like to overlay the geological map or the protected areas map in WMS

WMS layers should be another kind of layer in the layers panel.

Hope I made myself clear on what my use case would be, I think it's pretty common and would be useful to many I reckon.

All the best, thanks!

arteteco avatar Dec 11 '20 09:12 arteteco

So a layer control panel would be necessary? Also, would there be a base map? I think I'm mostly concerned about WMS layers as basemaps. If they are just overlays over top of a basemap, then that seems easy. My main concern is how to make it flexible enough to do both.

bozdoz avatar Dec 11 '20 14:12 bozdoz

Yes, my use case would be WMS as layer. Maybe we could make it so that for every WMS added we can choose if consider it a basemap or a layer?

EDIT: WMS also oftentimes give a lot of information, especially the legend should be very important to display. Seems like leaflet doesn't support it, so I'm not entirely sure if it's doable without a sort of a hack

arteteco avatar Dec 11 '20 19:12 arteteco