Show My Location on Google Maps API v3

后端 未结 4 1902
清酒与你
清酒与你 2020-12-04 22:33

"My Location" in Google Maps javascript API

This question was asked over half a year ago. Has Google Maps API v3 updated to use the \"My Location\" button

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-04 22:55

    We have made such a component for Google Maps API v3. Anybody can use in custom projects to add a control showing current geolocation with just one line of code:

    var geoloccontrol = new klokantech.GeolocationControl(map, mapMaxZoom);
    

    after including in the HTML header this JavaScript:

    
    

    See:

    http://www.maptiler.com/maptilerlayer/

    for an example code and documentation.

    It adds the standard control to the map - and once tapped - it shows the blue circle around your location with size derived from precision of the location data available. If you don't drag the map it will keep you positioned once you move.

    This control has been developed for viewer automatically generated by http://www.maptiler.com/ software - which creates tiles for map overlays and custom layers made from images and raster geodata.

提交回复
热议问题