ProfessionalWiki / Maps

🗺 Maps is the MediaWiki extension that enables visualization of geographic data with dynamic embedded maps.
https://maps.extension.wiki
Other
74 stars 61 forks source link

Leaflet shapes on different Layer Groups #622

Open RogueVortex opened 4 years ago

RogueVortex commented 4 years ago

Good afternoon. There is a need to disable some groups of requested tags using #ask. Perhaps you have thoughts on how best to implement this. https://leafletjs.com/examples/layers-control/ Thank you very much for your great work!

JeroenDeDauw commented 4 years ago

You can specify layers using the layers parameter. Example: https://maps.extension.wiki/wiki/Leaflet_Maps_examples#Layers

Does that do what you want?

RogueVortex commented 4 years ago

I mean a little different. I am making a request, for example {{#ask: [[Category: Events]] |? Coords |? TypeEvents | format = map | service = leaflet }} This way I get a map with a lot of marks. I would like to disable by filtering a number of labels on the map that are of the same type that are currently not of interest to me ...

JeroenDeDauw commented 4 years ago

You can use a more selective ask query: [[Category: Events]] [[SomeOtherRestriction]]. Or do you want to do live filtering?

RogueVortex commented 4 years ago

yes, live filtering using checkboxes, as made in leaflet https://leafletjs.com/examples/layers-control/ in the example, using the link, you can disable markers for the Cities group

JeroenDeDauw commented 4 years ago

Ok, now I understand: you where talking about the cities overlay

image

This is not currently possible. Would be nice to have though! If you have some funds available for development I could have a look.

RogueVortex commented 4 years ago

Yes, I meant it. I can’t boast of a good income living in Ukraine, but still I wonder how much money is needed to arouse your interest in this task?

JeroenDeDauw commented 4 years ago

You should see the income of an open source contributor :D 100 EUR would do it, even though I barely break even with that. Like I said, this would be a nice feature.

RogueVortex commented 4 years ago

I understand that this is not a lot of money, given the amount of work that has already been done and which is being carried out in the open source. I will try to support you at least a little in the near future, as I understand it is better to do this through sponsorship on git?

JeroenDeDauw commented 4 years ago

Sponsorship on GitHub is definitely welcome

JeroenDeDauw commented 4 years ago

@akuckartz I added a special tier for you ;)

@RogueVortex thank you :heart:

JeroenDeDauw commented 4 years ago

Ok, so what would this feature look like? Here is what comes to my mind:

{{#ask: [[Category: Cities]]
|? Coords
|? Continent
| format = leaflet
| layer property = Continent
}}

If the results of this query are

then the map would have a layer group named "Europe" with markers for Berlin and London, and one named "America" with a marker for New York.

Does that make sense? Any better approaches? @krabina you might also have some thoughts on this.

RogueVortex commented 4 years ago

It’s quite logical, probably you should immediately think about the ability to apply different icons for labels to different layers

JeroenDeDauw commented 4 years ago

Implementation of marker icons could be done similarly: https://github.com/JeroenDeDauw/Maps/issues/621. That would be per marker though, not per Layer Group. Not clear how to do the latter nicely, ideas welcome.

RogueVortex commented 4 years ago

Perhaps you should pay attention to how it is implemented here? https://www.semantic-mediawiki.org/wiki/Help:Filtered_format

RogueVortex commented 4 years ago

I also found how interesting and possibly useful to me https://www.mediawiki.org/wiki/Extension:Semantic_Compound_Queries

JeroenDeDauw commented 4 years ago

Yeah Compound queries are quite similar to what we where talking about here. I'll get to documenting them properly on the Maps wiki soon.

After some thinking about the Layer Groups I've come to realize that they are not so simple to implement. At least not in a way they are a full citizen of Maps. They need special handing for a bunch of features such a marker clustering, ajaxquery and the visual editor. In an initial version these combinations could just be left not supported however.

akuckartz commented 4 years ago

How can this feature be combined with https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/4611 ?

JeroenDeDauw commented 4 years ago

I'm not sure. Also unclear when and if this new faceted search will make it into SMW. And how it relates to the Filtered format, and to extensions adding visualizations to SMW. More a question for @mwjames since I have no idea what his plans here are and have not read through everything on the linked issue.

RogueVortex commented 4 years ago

Hi, I was browsing the wiki that use the map extension (indicated on the expansion site), I came across such a solution, I'm not so strong in the code, but maybe this will give food for thought ?!

https://www.transit.wiki/Bay_Area_Rapid_Transit

P.S. using the link you can see the implementation of the filter, though through the widget ...

JeroenDeDauw commented 4 years ago

Finally got around to installing Semantic Compound Queries on the Maps wiki and creating an example: https://twitter.com/JeroenDeDauw/status/1265219491174244352

RogueVortex commented 4 years ago

I haven’t put it into a working project yet, but used it on a local server, this is a useful thing, in the future I plan to add it to a working draft, but at the moment it does not solve the issue of disconnecting different marker groups assigned to a particular group in the request ...

JeroenDeDauw commented 4 years ago

If the below was supported, would it work for your usecase?

{{#compound_query:
   [[Category:Cities]] [[Located in::Germany]] ; ?Coordinates ; layer=Germany
 | [[Category:Cities]] [[Located in::Belgium]] ; ?Coordinates ; layer=Belgium
 | [[Category:Cities]] [[Located in::!Germany]] [[Located in::!Belgium]] ; ?Coordinates
 | format=map
}}

Both for the compound_query approach and the earlier suggested one (layer property = Continent), markers end up in a specific layer group. But there is no way to customize those layer groups beyond their names. I imagine you might want to control if a layer group is shown by default or not. It's not obvious to me where such information would fit nicely.

RogueVortex commented 4 years ago

I think if the labels of each set of query parameters find their class, then something can already be done with this, I think a good option

krabina commented 4 years ago

would the rest of the maps options work as well?

 | format=map
 | geojson=Europe
 | zoom=9
 |...
RogueVortex commented 4 years ago

would the rest of the maps options work as well?

 | format=map
 | geojson=Europe
 | zoom=9
 |...

I just checked on the Maps version 7.19.0 - everything works

image

RogueVortex commented 4 years ago

Hi, was it not possible to address the issue on the topic?

JeroenDeDauw commented 4 years ago

I have not looked into it yet.

RogueVortex commented 4 years ago

I have not looked into it yet.

in any case, as far as I am allowed I'm trying to support you)

c-holtermann commented 3 years ago

I'm interested in this feature as well. It has not been implemented, has it?

JeroenDeDauw commented 3 years ago

Not worked upon this, and personally no plans to do so in my free time, even if it is a cool feature

c-holtermann commented 3 years ago

I'd be willing to give/collect some money for it as has been discussed before. Could that still change your interest? I just created a map of anthroposophic medicine in Berlin which is growing crowded (https://de.imedwiki.org/wiki/Anthroposophische_Medizin_in_Berlin). It is intended for a meeting of doctors and I could ask them if everyone chips in a bit. I'd like to support open source development and have a good opensource map extension to show diverse data. I like Maps so far.

krabina commented 3 years ago

So as far as I understand it, this feature request is basically about being able to filter items that are displayed on a map. While doing this with the leaflet function might be a good idea, we should also discuss the following:

  1. Filtered format: it already has this capability and a maps view. Unfortunately, filtered has its own maps implementation that is independent of the maps extension. I think this is a bad idea, because for mapping the maps extension is way better. So the problem is that every maps feature you might want to have on a filtered map would have to be re-implemented in the filtered restult format. I don't know if and how it would be possible for the filtered format to enable a maps view that is only working if the maps extension is present and is using the maps extension.
  2. Semantic Drilldown: this extension also already has a filtering option that can display the results on a map. Currently, it is not very flexible: you have to decide whether you want SD to use a map display or any other display (per default a category view). I am in the process of funding an update of SD so it is more flexible and will allow for parameters who determin which view to use. As far as I understand it, SD is relying on the maps extension for the display, so it does not have the problem of the filtered format.

There is another difference: both the filtered format and the leaflet layer groups rely on all data being loaded into the frontend. In very large maps, this can be a problem. SD has a different approach that is better suited for large data.

The SD topic is IMO not so important for this discussion: as it will be using the maps extension, it is just another alternative that you have.

When thinking about implementing layer groups in the maps extension, we might consider that this approach would be directly in "competition" with the filtered result format.

Maybe it would be an option to redesign the filtered result format in a way that is uses the maps extension. This way, implementing this feature (layer groups) might not be needed anymore or can be added later if still needed. Of course, I have no idea about the effort for both approaches.

c-holtermann commented 3 years ago

Thank you for showing those different posibilities. I just tried fiddling with the existing maps capabilities and hide markers with javascript identified by their image files. This works for static situations but when things start moving like zooming or panning or unclustering new ones show up that can not easily be catched by a click event on a checkfield. I'm tempted to remove, hide or add markers using javascript and the leaflet map found in mapsLeafletList to hide/show also the hidden ones but it's a bit complicated to even get all existing markers.

JeroenDeDauw commented 3 years ago

Yeah that code got complicated with dynamic loading and especially with the clustering.

krabina commented 3 years ago

@JeroenDeDauw what is your opinion on the filtered format vs. filter feature in maps? Is there any chance we could "pug in" the maps extension in the filtered format?

JeroenDeDauw commented 3 years ago

Plugging things in sounds nice. Hard to tell what the best approach here is without significant investigation. Same for technical feasibility.