Geolocation Marker for Google Maps v3 Reference

Note: This library will only function in browsers supporting the W3C Geolocation API. This excludes Internet Explorer versions 8 and older.

GeolocationMarker class

This class extends google.maps.MVCObject.

Constructor

Constructor Description
GeolocationMarker(map?:google.maps.Map, marker_opts?:google.maps.MarkerOptions, circle_opts?:google.maps.CircleOptions) A marker and accuracy circle positioned on the map to track the user's location.

Methods

Methods Return Value Description
getAccuracy() number|null Returns the current accuracy of the location data. Will return null if a position has not yet been obtained.
getBounds() google.maps.LatLngBounds|null Returns the lat/lng bounds containing the marker and accuracy circle. Will return null if a position has not yet been obtained.
getMap() google.maps.Map
getMinimumAccuracy() number|null Returns the minimum accuracy (in meters) that must be achieved before the marker is initially drawn on the map. Returns null if no minimum is specified.
getPosition() google.maps.LatLng|null Returns the center of the marker and accuracy circle. Will return null if a position has not yet been obtained.
getPositionOptions() PositionOptionsInterface Returns the current options used to call the geolocation.watchPosition method.
setCircleOptions(options:google.maps.CircleOptions) This method will ignore certain properties of the google.maps.CircleOptions object. It will ignore position, radius and map properties as these are set by the library.
setMap(map:google.maps.Map)
setMarkerOptions(options:google.maps.MarkerOptions) This method will ignore certain properties of the google.maps.MarkerOptions object. It will ignore position and map properties as these are set by the library.
setMinimumAccuracy(accuracy:number|null) Sets the minimum accuracy (in meters) that must be achieved before the marker is initially drawn on the map.
setPositionOptions( positionOpts:PositionOptionsInterface) Sets the options used to call the geolocation.watchPosition method.

Events

Events Arguments Description
accuracy_changed
geolocation_error PositionErrorInterface Triggered whenever geolocation fails. Can be caused by a user denying permission to access location data.
position_changed