【问题标题】:Embedding google map with address嵌入带有地址的谷歌地图
【发布时间】:2013-06-29 08:42:26
【问题描述】:

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

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

请帮忙

谢谢:D

【问题讨论】:

标签: php mysql google-maps google-maps-api-3


【解决方案1】:

您可以添加一个 iframe,将 MySQL 数据库中的地址作为 URL 参数传递。

<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>

【讨论】:

    【解决方案2】:

    您想知道纬度和经度的值以在地图上标记一个地方。 您可以使用 Google API 获取纬度和经度。将此值传递给 Google MAP。 Get latitude and longitude查看此链接以使用 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);
    

    【讨论】:

    • 我不知道经纬度。我只有一个地址。
    • stackoverflow.com/questions/8633574/… 检查此链接。您可以从地址获取纬度和经度。
    • 哦,好的。对不起,我一开始没看,但现在我明白了。非常感谢。我试试看
    • 好的,告诉我它是否有效。也不要忘记接受答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-27
    • 2012-10-31
    • 2013-04-11
    • 2013-08-08
    相关资源
    最近更新 更多