Difference between revisions of "Distance queries"

From Maps for MediaWiki
(Created page with "Maps supports "distance queries" via its integration with Semantic MediaWiki. Distance queries are an extension to Semantic MediaWiki's query syntax. T...")
 
m
 
(2 intermediate revisions by the same user not shown)
Line 23: Line 23:
== Example ==
== Example ==


{{#ask: [[Category:Cities]] [[Has coordinates::50° 50' 48" N, 4° 21' 10" E  (420 km)]]
<pre>
{{#ask: [[Category:Cities]] [[Coordinates::50° 50' 48" N, 4° 21' 10" E  (420 km)]]
  | format=map
  | format=map
  | ?Coordinates
  | ?Coordinates
}}
}}
</pre>


<pre>
{{#ask: [[Category:Cities]] [[Coordinates::50° 50' 48" N, 4° 21' 10" E  (420 km)]]
{{#ask: [[Category:Cities]] [[Has coordinates::50° 50' 48" N, 4° 21' 10" E  (420 km)]]
  | format=map
  | format=map
  | ?Coordinates
  | ?Coordinates
Line 35: Line 36:
}}
}}


Same query but without the distance restriction:
<pre>
{{#ask: [[Category:Cities]]
| format=map
| ?Coordinates
}}
</pre>
</pre>
{{#ask: [[Category:Cities]]
| format=map
| ?Coordinates
| scrollzoom=off
}}

Latest revision as of 08:35, 17 May 2020

Maps supports "distance queries" via its integration with Semantic MediaWiki.

Distance queries are an extension to Semantic MediaWiki's query syntax. They allow restricting results to those with coordinates close to a specified location.

Query syntax[edit | edit source]

[[PropertyName::coordinates (distance)]]

Example:

[[Coordinates::50° 50' 48" N, 4° 21' 10" E  (420 km)]]

This restricts the results to pages (or subjects) with a value for the Coordinates property that is within 420 kilometers of Brussels.

Supported distance units[edit | edit source]

All units supported by the distance function are also supported in distance queries.

Accuracy[edit | edit source]

Distance queries are not entirely accurate. They restrict results by creating a bounding box (square) around the specified location. This means some results that are outside the specified range might still be included.

Example[edit | edit source]

{{#ask: [[Category:Cities]] [[Coordinates::50° 50' 48" N, 4° 21' 10" E  (420 km)]]
 | format=map
 | ?Coordinates
}}
Loading map...

Same query but without the distance restriction:

{{#ask: [[Category:Cities]]
 | format=map
 | ?Coordinates
}}
Loading map...