如何插入谷歌地图 [英] how to insert google map
本文介绍了如何插入谷歌地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
首先我很抱歉,因为我的英语不好
我想在新成员确定自动登记并将其保存在我的数据库中时放入谷歌地图
Hello
First iam sorry because my English is not good
I want to put Google map when a new member determines automatic lcation and keeps it in my database
推荐答案
只存储经度和纬度,你可以得到实际的地图
store only longitude and latitude and you can get actual map
使用 HTML5地理位置 [ ^ 获取用户的位置 -
Use HTML5 Geolocation[^] for getting the user's location -
<script>
var lat = 0; lon = 0;
var x = document.getElementById("demo");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
lat = position.coords.latitude;
lon = position.coords.longitude;
}
</script>
那些 lat $ c google地图中的$ c>和
lon
-
And those lat
and lon
in google's map -
function initialize() {
var mapProp = {
center:new google.maps.LatLng(lat, lon),
zoom:5,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
}
google.maps.event.addDomListener(window, 'load', initialize);
请参阅 - 创建基本Google地图 [ ^ ]
-KR
Refer this - Create a Basic Google Map[^]
-KR
这篇关于如何插入谷歌地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文