Geolocate Plugin - geosolutions-it/MapStore GitHub Wiki
This Plugin exposes the OpenLayers Geolocate Control. It can be used as a single button to retrieve the current position or as a switch to enable continuous tracking.
Needed Files
Include in buildjs these files:
gxp/src/script/plugins/Geolocate.js
openlayers/lib/OpenLayers/Control/Geolocate.js
Configuration Example
{
"ptype":"gxp_geolocate",
"enableTracking" : false,
"layerName": "Position",
"bind": true,
"zoom": true,
"displayInLayerSwitcher": false,
"geolocationStyles": {
"pointStyle":{
"graphicName": "circle",
"strokeColor": "#aaa",
"fillColor": "#11f",
"strokeWidth": 2,
"fillOpacity": 0.7,
"strokeOpacity": 0.6,
"pointRadius": 5
},"auraStyle":{
"fillOpacity": 0.3,
"fillColor": "#55b",
"strokeColor": "#00f",
"strokeOpacity": 0.6
},
"geolocationOptions": {
"enableHighAccuracy": true,
"maximumAge": 0,
"timeout": 7000
}
},
"actionTarget":{
"target":"paneltbar",
"index": 22
}
}
ptype
: ptype of the pluginenableTracking
: specific if the plugin must track the position or notbind
: the map will center on the found positionzoom
: the map will center and zoom on the found position (overrides 'bind')displayInLayerSwitcher
: display the layer in the layer switcherlayerName
: layer name to display in the layer switchergeolocationStyles
: options for the Marker layer stylepointStyle
: style for an OpenLayers.Geometry.PointauraStyle
: style for an OpenLayers.Geometry.Polygon
geolocationOptions
: options to pass to the OpenLayers Geolocate Plugin :- enableHighAccuracy : true/false, ask the browser for an high accuracy position
- maximumAge: accept a cached position whose age is no greater than the specified time in milliseconds
- timeout: maximum length of time (in milliseconds) that is allowed to pass from the call to getCurrentPosition() or watchPosition() until the corresponding successCallback
actionTarget
: plugin target (plugin general configuration)