如何获得Latitude&来自Geo_Autocomplete API的经度 [英] How To Get Latitude & Longitude From Geo_Autocomplete API
本文介绍了如何获得Latitude&来自Geo_Autocomplete API的经度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从谷歌地图geo_autocomplete获得经度和纬度。有没有办法获得纬度和经度,我的ocde在下面。
I want to get longitude and latitude from google map geo_autocomplete. Is there any way to get latitude and longitude, my ocde is below.
$(document).ready(function () {
jQuery.noConflict();
var latlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
$('#location').geo_autocomplete(new google.maps.Geocoder, {
mapkey: 'ABQIAAAAbnvDoAoYOSW2iqoXiGTpYBTIx7cuHpcaq3fYV4NM0BaZl8OxDxS9pQpgJkMv0RxjVl6cDGhDNERjaQ',
selectFirst: false,
minChars: 3,
cacheLength: 50,
width: 550,
scroll: true,
scrollHeight: 330
}).result(function (_event, _data) {
if (_data) map.fitBounds(_data.geometry.viewport);
});
});
推荐答案
(document).ready(function(){
jQuery .noConflict();
var latlng = new google.maps.LatLng(-34。 397 , 150 。 644 );
var myOptions = {
zoom: 8 ,
center:latlng ,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById( map_canvas),myOptions );
(document).ready(function () { jQuery.noConflict(); var latlng = new google.maps.LatLng(-34.397, 150.644); var myOptions = { zoom: 8, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
(' #position')。geo_autocomplete( 新 goog le.maps.Geocoder,{
mapkey:' ABQIAAAAbnvDoAoYOSW2iqoXiGTpYBTIx7cuHpcaq3fYV4NM0BaZl8OxDxS9pQpgJkMv0RxjVl6cDGhDNERjaQ',
selectFirst : false ,
minChars: 3 ,
cacheLength: 50 ,
宽度: 550 ,
scroll: true ,
scrollHeight: 330
})。result(function(_event,_data){
if (_ data)map.fitBounds(_data.geometry.viewport);
});
});
('#location').geo_autocomplete(new google.maps.Geocoder, { mapkey: 'ABQIAAAAbnvDoAoYOSW2iqoXiGTpYBTIx7cuHpcaq3fYV4NM0BaZl8OxDxS9pQpgJkMv0RxjVl6cDGhDNERjaQ', selectFirst: false, minChars: 3, cacheLength: 50, width: 550, scroll: true, scrollHeight: 330 }).result(function (_event, _data) { if (_data) map.fitBounds(_data.geometry.viewport); }); });
http://stackoverflow.com/questions/5188173/how-to-get-lat-lng-from-a -geo-autocomplete-object-and-google-api-v2 [ ^ ]
这篇关于如何获得Latitude&来自Geo_Autocomplete API的经度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文