« Ajaxquery » : différence entre les versions
Aucun résumé des modifications |
m (Remplacement de texte — « Maps example » par « Maps examples ») |
||
(9 versions intermédiaires par 2 utilisateurs non affichées) | |||
Ligne 1 : | Ligne 1 : | ||
== Issue == | == Issue == | ||
You don't want all the points on the map to load, just the points that are currently in the field of view. | 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 == | |||
<pre> | |||
{{#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 | |||
}} | |||
</pre> | |||
In this example <code><nowiki>[[Category:Location]] [[Has coordinates::52° 30' 59", 13° 24' 0" E (50 km)]] [[Has coordinates::+]]</nowiki></code> is triggered on loading the map for the first time and <code><nowiki>ajaxquery = [[Category:Locations]]</nowiki></code> 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 <code>ajaxquery</code> and <code>ajaxcoordproperty</code> need to be set to make it work. <code>ajaxquery</code> contains an ask or compound query, <code>ajaxcoordproperty</code> contains the name of the property that describe the coordinates. Compound queries can be connected with <code><nowiki>{{!}}</nowiki></code>, instead of <code>|</code>, like this: <code><nowiki>| ajaxquery = [[Category:Wien]] {{!}} [[Category:Graz]]</nowiki></code>. | |||
{{#ask: | {{#ask: | ||
[[Category: | [[Category:Location]] [[Has coordinates::52° 30' 59", 13° 24' 0" E (50 km)]] [[Has coordinates::+]] | ||
| ?Has coordinates | | ?Has coordinates | ||
| format = leaflet | | format = leaflet | ||
| ajaxquery = [[Category:Locations]] | | ajaxquery = [[Category:Locations]] | ||
| ajaxcoordproperty = Has coordinates | | ajaxcoordproperty = Has coordinates | ||
}} | |||
== example without ajax, no new points are loaded when zooming out == | |||
<pre> | |||
{{#ask: | |||
[[Category:Location]] [[Has coordinates::52° 30' 59", 13° 24' 0" E (50 km)]] [[Has coordinates::+]] | |||
| ?Has coordinates | |||
| format = leaflet | |||
}} | }} | ||
</pre> | </pre> | ||
{{#ask: | {{#ask: | ||
[[Category: | [[Category:Location]] [[Has coordinates::52° 30' 59", 13° 24' 0" E (50 km)]] [[Has coordinates::+]] | ||
| ?Has coordinates | | ?Has coordinates | ||
| format= | | format = leaflet | ||
}} | }} | ||
[[Category: | [[Category:Maps examples]] |
Dernière version du 8 octobre 2017 à 20:50
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 }}