Oskari API documentation

Select request

admindown-arrow
frameworkdown-arrow
mappingdown-arrow
uidown-arrow

StartUserLocationTrackingRequest RPC

Start tracking user's location.

Use cases

  • Record path and add the path to the map
  • Center the map to the user's location when location changes

Description

This request is used to track user's geolocation. After the geolocation is changed a UserLocationEvent is triggered. Optionally the location or the path can be added to the map.

Parameters

(* means the parameter is required)

Name Type Description Default value
options Object Parameters for options-object are listed in the next table

Parameters for options-object:

Name Type Description Default value
centerMap String If 'single', centers the map to user's location and zooms map according to location accuracy. If 'update', centers map also on location update.
addToMap String If 'point', adds user's location as point. If 'location', adds point with location accuracy circle. If 'path', adds location path to the map and adds new point to path on location update. false
enableHighAccuracy Boolean true to receive the best possible location results true
timeout Number Maximum length of time (in milliseconds) the device is allowed to take in order to return a position 6000
maximumAge Number Maximum age in milliseconds of a possible cached position. If set to 0 tries to attempt real (not cached) position. 5000

Examples

Start tracking user's location, move the map to location and add location with accuracy circle to the map:

var sb = Oskari.getSandbox();
sb.postRequestByName('StartUserLocationTrackingRequest', [{addToMap: 'location', centerMap: 'single'}]);

Start tracking user's location and add path to the map:

var sb = Oskari.getSandbox();
sb.postRequestByName('StartUserLocationTrackingRequest', [{addToMap: 'path', centerMap: 'update'}]);

Related api

  • StopUserLocationTrackingRequest
  • UserLocationEvent
  • AddFeaturesToMapRequest