Geolocation Marker for Google Maps v3

来源:互联网 发布:云计算 pdf 编辑:程序博客网 时间:2024/05/16 13:58

Geolocation Marker for Google Maps v3

This library uses geolocation to add a marker and accuracy circle to a map. The marker position is automatically updated as the user position changes.

To add the Geolocation Marker, just instantiate a new GeolocationMarker object, passing your map to it:

var mapOptions = {  zoom: 17,  center: new google.maps.LatLng(-34.397, 150.644),  mapTypeId: google.maps.MapTypeId.ROADMAP};var map = new google.maps.Map(document.getElementById('map_canvas'),  mapOptions);var GeoMarker = new GeolocationMarker(map);

See the example.

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

class GeolocationMarker

This class extends google.maps.MVCObject.

Constructor

ConstructorDescriptionGeolocationMarker(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

MethodsReturn ValueDescriptiongetAccuracy()number|nullReturns the current accuracy of the location data. Will return null if a position has not yet been obtained.getBounds()google.maps.LatLngBounds|nullReturns the lat/lng bounds containing the marker and accuracy circle. Will returnnull if a position has not yet been obtained.getMap()google.maps.Map getMinimumAccuracy()number|nullReturns the minimum accuracy (in meters) that must be achieved before the marker is initially drawn on the map. Returnsnull if no minimum is specified.getPosition()google.maps.LatLng|nullReturns the center of the marker and accuracy circle. Will return null if a position has not yet been obtained.getPositionOptions()PositionOptionsInterfaceReturns 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 ignoreposition, radius andmap 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 ignoreposition 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

EventsArgumentsDescriptionaccuracy_changed  geolocation_errorPositionErrorInterfaceTriggered whenever geolocation fails. Can be caused by a user denying permission to access location data.position_changed
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 风油精泼白墙上怎么办 壁纸涂上油画棒怎么办 心里不能装事怎么办 做事做不快心急怎么办 焦虑症不想上班怎么办 总是忘事应该怎么办 vary渲染太黑怎么办 su一直未响应怎么办 草图大师版本低打不开怎么办 重要纸上滴上油了怎么办 水拓画颜料滴太多怎么办 微信语音撤不回怎么办 kido手表关机了怎么办 玩具店不想开了怎么办 幼儿不拉粑粑怎么办 幼儿拉绿色粑粑怎么办 幼儿拉青粑粑怎么办 小孩龋齿牙疼怎么办 宝宝刷牙不张嘴怎么办 宝宝爱吃棒棒糖怎么办 孩子不刷牙洗脸怎么办 宝宝害怕拉大便怎么办 狗狗不喜欢刷牙怎么办 10小孩不刷牙怎么办 孩子做事磨叽怎么办 一岁半宝宝不愿意刷牙怎么办 两岁半宝宝不愿意刷牙怎么办 小孩牙齿长蛀牙怎么办 2周岁宝宝龋齿怎么办 小孩刷牙吞牙膏怎么办 孩子12不肯刷牙怎么办 小孩牙齿空了怎么办 孩子掉了牙不长怎么办 小朋友不敢看牙医怎么办 小孩不喜欢洗脸刷牙怎么办 宝宝洗澡老是哭怎么办 孩子越来越怕打针怎么办 16孩子不爱洗澡怎么办 死手系统出问题怎么办 死手系统地震怎么办 唱歌掌握不好气息怎么办