Maps icon indicating copy to clipboard operation
Maps copied to clipboard

Leaflet shapes on different Layer Groups

Open RogueVortex opened this issue 5 years ago • 36 comments

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!

RogueVortex avatar May 22 '20 08:05 RogueVortex

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

Does that do what you want?

JeroenDeDauw avatar May 22 '20 09:05 JeroenDeDauw

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 ...

RogueVortex avatar May 22 '20 09:05 RogueVortex

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

JeroenDeDauw avatar May 22 '20 10:05 JeroenDeDauw

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

RogueVortex avatar May 22 '20 10:05 RogueVortex

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.

JeroenDeDauw avatar May 22 '20 10:05 JeroenDeDauw

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?

RogueVortex avatar May 22 '20 11:05 RogueVortex

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.

JeroenDeDauw avatar May 22 '20 11:05 JeroenDeDauw

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?

RogueVortex avatar May 22 '20 12:05 RogueVortex

Sponsorship on GitHub is definitely welcome

JeroenDeDauw avatar May 22 '20 12:05 JeroenDeDauw

@akuckartz I added a special tier for you ;)

@RogueVortex thank you :heart:

JeroenDeDauw avatar May 22 '20 15:05 JeroenDeDauw

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

  • Berlin: Continent=Europe, Coords=whatever
  • London: Continent=Europe, Coords=whatever
  • New York: Continent=America, Coords=whatever

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.

JeroenDeDauw avatar May 22 '20 15:05 JeroenDeDauw

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

RogueVortex avatar May 22 '20 15:05 RogueVortex

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.

JeroenDeDauw avatar May 22 '20 16:05 JeroenDeDauw

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

RogueVortex avatar May 22 '20 16:05 RogueVortex

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

RogueVortex avatar May 23 '20 17:05 RogueVortex

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.

JeroenDeDauw avatar May 24 '20 14:05 JeroenDeDauw

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

akuckartz avatar May 24 '20 15:05 akuckartz

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.

JeroenDeDauw avatar May 24 '20 15:05 JeroenDeDauw

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 ...

RogueVortex avatar May 26 '20 06:05 RogueVortex

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

JeroenDeDauw avatar May 26 '20 09:05 JeroenDeDauw

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 ...

RogueVortex avatar May 26 '20 11:05 RogueVortex

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.

JeroenDeDauw avatar May 26 '20 13:05 JeroenDeDauw

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

RogueVortex avatar May 26 '20 15:05 RogueVortex

would the rest of the maps options work as well?

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

krabina avatar May 26 '20 16:05 krabina

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 avatar May 26 '20 16:05 RogueVortex

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

RogueVortex avatar Jun 24 '20 20:06 RogueVortex

I have not looked into it yet.

JeroenDeDauw avatar Jun 25 '20 16:06 JeroenDeDauw

I have not looked into it yet.

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

RogueVortex avatar Jun 25 '20 16:06 RogueVortex

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

c-holtermann avatar Aug 10 '21 10:08 c-holtermann

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

JeroenDeDauw avatar Aug 10 '21 10:08 JeroenDeDauw