Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google app engine Gmap API V3标记坐标_Google App Engine_Google Maps - Fatal编程技术网

Google app engine Gmap API V3标记坐标

Google app engine Gmap API V3标记坐标,google-app-engine,google-maps,Google App Engine,Google Maps,我已经找到了一个例子,若有人需要,但我需要从地址中获取第一个坐标,以便以后可以调整它。有人知道怎么做吗 var geocoder=new google.maps.geocoder 如果您的浏览器支持使用此功能获取坐标所需的地理位置: navigator.geolocation.getCurrentPositionfunctionposition{ geolocationCoordinates=new google.maps.LatLngposition.coords.lation,positio

我已经找到了一个例子,若有人需要,但我需要从地址中获取第一个坐标,以便以后可以调整它。有人知道怎么做吗

var geocoder=new google.maps.geocoder


如果您的浏览器支持使用此功能获取坐标所需的地理位置:

navigator.geolocation.getCurrentPositionfunctionposition{ geolocationCoordinates=new google.maps.LatLngposition.coords.lation,position.coords.longitude; //position.coords.latitude=纬度坐标; //position.coords.longitude=经度坐标; }

之后,您可以使用此坐标创建一个新地图

此代码在所有支持地理定位的浏览器中都能正常工作

function geocodePosition(pos) {    
  geocoder.geocode({    
    latLng: pos    
  }, function(responses) {  
    if (responses && responses.length > 0) {  
      updateMarkerAddress(responses[0].formatted_address);  
    } else {  
      updateMarkerAddress('Cannot determine address at this location.');  
    }  
  });  
}  

function updateMarkerStatus(str) {  
  document.getElementById('markerStatus').innerHTML = str;  
}  

function updateMarkerPosition(latLng) {  
  document.getElementById('info').innerHTML = [  
    latLng.lat(),  
    latLng.lng()  
  ].join(', ');  
}  

function updateMarkerAddress(str) {  
  document.getElementById('address').innerHTML = str;  
} 



function initialize() {  


 var latLng = new google.maps.LatLng(1.54232,-1.4353423);  

  var map = new google.maps.Map(document.getElementById('mapCanvas'), {  
    zoom: 8,  
    center: latLng,  
    mapTypeId: google.maps.MapTypeId.ROADMAP
  });
  var marker = new google.maps.Marker({
    position: latLng,
    title: 'Point A',
    map: map,
    draggable: true
  });  

  // Update current position info.  
  updateMarkerPosition(latLng);  
  geocodePosition(latLng);  

  // Add dragging event listeners.  
  google.maps.event.addListener(marker, 'dragstart', function() {  
    updateMarkerAddress('Dragging...');  
  });  

  google.maps.event.addListener(marker, 'drag', function() {  
    updateMarkerStatus('Dragging...');    
    updateMarkerPosition(marker.getPosition());  
  });  

  google.maps.event.addListener(marker, 'dragend', function() {  
    updateMarkerStatus('Drag ended');  
    geocodePosition(marker.getPosition());  
  });  


// Onload handler to fire off the app.  
google.maps.event.addDomListener(window, 'load', initialize);