Ajaxquery

De Semantic MediaWiki - Sandbox

Révision datée du 8 octobre 2017 à 20:50 par Kghbln (discussion | contributions) (Remplacement de texte — « Maps example » par « Maps examples »)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)

Issue

You don't want all the points on the map to load (because of performance reasons), just the points that are currently in the field of view.

Load new points when dragging/zooming the map

{{#ask:
[[Category:Location]] [[Has coordinates::52° 30' 59", 13° 24' 0" E  (50 km)]] [[Has coordinates::+]]
| ?Has coordinates
| format = leaflet
| ajaxquery = [[Category:Locations]]
| ajaxcoordproperty = Has coordinates
}}

In this example [[Category:Location]] [[Has coordinates::52° 30' 59", 13° 24' 0" E (50 km)]] [[Has coordinates::+]] is triggered on loading the map for the first time and ajaxquery = [[Category:Locations]] when moving or zooming the map. The first query has a limited range (50 km), the second query is always limited by the current field of view.

Both ajaxquery and ajaxcoordproperty need to be set to make it work. ajaxquery contains an ask or compound query, ajaxcoordproperty contains the name of the property that describe the coordinates. Compound queries can be connected with {{!}}, instead of |, like this: | ajaxquery = [[Category:Wien]] {{!}} [[Category:Graz]].


example without ajax, no new points are loaded when zooming out

{{#ask:
[[Category:Location]] [[Has coordinates::52° 30' 59", 13° 24' 0" E  (50 km)]] [[Has coordinates::+]]
| ?Has coordinates
| format = leaflet
}}
Les cookies nous aident à fournir nos services. En utilisant nos services, vous acceptez notre utilisation de cookies.