【发布时间】:2013-04-02 07:15:06
【问题描述】:
我听说可以提交地址而不是经度和纬度,这对我的系统来说更可行。用户在创建他们的个人资料时必须输入他们的地址,然后他们的个人资料将显示他们家的谷歌地图。我目前的 Google Maps API 与经度和纬度完美配合:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="css.css" />
<title>Login Page</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map-canvas { height: 100% }
</style>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=MYKEY&sensor=false">
</script>
<script type="text/javascript">
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(52.640143,1.28685),
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map"),
mapOptions);
var marker = new google.maps.Marker({
position: new google.maps.LatLng(52.640143,1.28685),
map: map,
title: "Mark On Map"
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
请有人帮助我修改我的代码,以便 Google Maps API 能够在其位置请求地址,因为我想直接从 mySQL 数据库中读取用户的地址。
【问题讨论】:
标签: javascript google-maps google-maps-api-3 latitude-longitude street-address