Compound queries: Difference between revisions

From Maps for MediaWiki
(Created page with "{{#compound_query: Category:Cities Country:Germany ; ?Coordinates ; icon=Green-marker.png |Category:Cities Country:Belgium ; ?Coordinates ; icon=Red-marker....")
 
mNo edit summary
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
Maps can be used together with the [https://www.mediawiki.org/wiki/Extension:Semantic_Compound_Queries Semantic Compound Queries extension].
Semantic Compound Queries allows displaying the results of multiple queries together. This is done via the <code>#compound_query</code> parser function.
The below example runs 3 queries: cities in Germany, cities in Belgium, and cities in neither of those two countries. Cities in Germany get a green marker icon, those in Belgium get a red one, and those in neither use the default marker icon.
<pre>
{{#compound_query:
{{#compound_query:
  [[Category:Cities]] [[Country:Germany]] ; ?Coordinates ; icon=Green-marker.png
  [[Category:Cities]] [[Located in::Germany]] ; ?Coordinates ; icon=Green-marker.png
  |[[Category:Cities]] [[Country:Belgium]] ; ?Coordinates ; icon=Red-marker.png
  | [[Category:Cities]] [[Located in::Belgium]] ; ?Coordinates ; icon=Red-marker.png
  |format=map
| [[Category:Cities]] [[Located in::!Germany]] [[Located in::!Belgium]] ; ?Coordinates
  | format=map
}}
}}
</pre>
{{#compound_query:
  [[Category:Cities]] [[Located in::Germany]] ; ?Coordinates ; icon=Green-marker.png
| [[Category:Cities]] [[Located in::Belgium]] ; ?Coordinates ; icon=Red-marker.png
| [[Category:Cities]] [[Located in::!Germany]] [[Located in::!Belgium]] ; ?Coordinates
| format=map
| scrollzoom=off
| hidenamespace=yes
}}
You can customize maps shown via compound queries with the same parameters available in regular [[Semantic MediaWiki]] queries with a map result format. See [[Leaflet SMW queries]] and [[Google Maps SMW queries]] for more information on available parameters.

Latest revision as of 17:47, 26 May 2020

Maps can be used together with the Semantic Compound Queries extension.

Semantic Compound Queries allows displaying the results of multiple queries together. This is done via the #compound_query parser function.

The below example runs 3 queries: cities in Germany, cities in Belgium, and cities in neither of those two countries. Cities in Germany get a green marker icon, those in Belgium get a red one, and those in neither use the default marker icon.

{{#compound_query:
   [[Category:Cities]] [[Located in::Germany]] ; ?Coordinates ; icon=Green-marker.png
 | [[Category:Cities]] [[Located in::Belgium]] ; ?Coordinates ; icon=Red-marker.png
 | [[Category:Cities]] [[Located in::!Germany]] [[Located in::!Belgium]] ; ?Coordinates
 | format=map
}}

{{#compound_query: Germany ; ?Coordinates ; icon=Green-marker.png

| Belgium ; ?Coordinates ; icon=Red-marker.png
| !Germany !Belgium ; ?Coordinates
| format=map
| scrollzoom=off
| hidenamespace=yes

}}

You can customize maps shown via compound queries with the same parameters available in regular Semantic MediaWiki queries with a map result format. See Leaflet SMW queries and Google Maps SMW queries for more information on available parameters.