1

我有一个带有地址的 MySql 数据库,我想嵌入显示一个地址的谷歌地图 API。

我如何使用谷歌地图 API 在页面上嵌入显示这些地址之一的地图。

请帮忙

感谢:D

4

2 回答 2

1

您想知道纬度和经度的值以在地图中标记一个地方。您可以使用 Google API 获取纬度和经度。将此值传递给 Google MAP。 获取纬度和经度检查此链接以使用 Google API 获取纬度和经度

地图画布脚本

<div id="map_canvas" style="width:650px; height:300px"></div>
lat = latitude value from Google API
lon = longitude value from Google API
var mapOptions = {
center: new google.maps.LatLng(lat,lon),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP,
};
var map = new google.maps.Map(document.getElementById("map_canvas"),mapOptions);
于 2013-07-02T05:23:09.187 回答
1

You can add an iframe pass the address from MySQL Database as an URL parameter.

<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.it/maps?q=<?php echo $yourAddress; ?>&output=embed"></iframe>
于 2018-04-19T12:46:37.450 回答