Creating API maps with DOT markers
<Scriptsrc= "http://webapi.amap.com/maps?v=1.4.1&key=bcf87f3263f98cc37309298bca20c622"></Script><Scripttype= "Text/javascript"> //Instantiating point Markers functionAddmarker () {marker= Newamap.marker ({icon:"Http://webapi.amap.com/theme/v1.3/markers/n/mark_b.png", Position: [116.41, 39.91] }); Marker.setmap (map); } varMap= NewAmap.map ('Container', {resizeenable:true, center: [116.40, 39.91], zoom: - }); Addmarker ();</Script>
Get current latitude and longitude based on browser location
<DivID= "Container_display"></Div><Scriptsrc= "https://webapi.amap.com/maps?v=1.4.1&key=bcf87f3263f98cc37309298bca20c622"></Script><Script>functionLoadingcurrentposition (callback) {document.getElementById ('Container_display'). InnerHTML= "'; //load map, invoke browser location serviceMap= NewAmap.map ('Container_display', {resizeenable:true }); Map.plugin ('amap.geolocation', function() {geolocation= Newamap.geolocation ({enablehighaccuracy:true,//whether to use high precision positioning, default: TrueTimeout:10000, //stop positioning after more than 10 seconds, default: InfinityButtonoffset:NewAmap.pixel (Ten, -),//The offset of the position button and the set docking position, default: Pixel (Ten)zoomtoaccuracy:true, //Adjust the map's field of view after successful positioning to make the location and accuracy range visible in the field of view, default: falsebuttonposition:'RB' }); Map.addcontrol (geolocation); Geolocation.getcurrentposition (); AMap.event.addListener (geolocation,' Complete', oncomplete);//Back to location informationAMap.event.addListener (geolocation,'Error', OnError); //return location error message }); //Resolve positioning Results functionOnComplete (data) {varGetlngdata=Data.position.getLng (); varGetlatdata=Data.position.getLat (); if(callback) {callback (getlngdata,getlatdata);//passing longitude and latitude in callback parameters } } //Resolving positional error messages functionOnError (data) {alert ('failed to locate'); }}$(function(){ varGETLNG= "'; //Deposit Longitude varGetlat= "'; //Storage Latitude //default loading automatically gets the current person's location onceLoadingcurrentposition (function(lngdata,latdata) {getlng=Lngdata; Getlat=Latdata; }); $(". GetCurrentPosition"). On ('Click',function() {loadingcurrentposition (function(lngdata,latdata) {getlng=Lngdata; Getlat=Latdata; }); });})</Script>
German map get current latitude and longitude API based on browser location address: http://lbs.amap.com/api/javascript-api/example/location/browser-location
German Open platform: HTTP://LBS.AMAP.COM/API
Code Note: Create a map with the high-D map API and get the current address latitude and longitude