【问题标题】:Customize embedded google maps (adding location marks)?自定义嵌入式谷歌地图(添加位置标记)?
【发布时间】:2014-01-28 07:50:47
【问题描述】:

我正在尝试在一家公司的谷歌地图中添加位置详细信息,我目前正在使用此代码将地图位置嵌入网站:

<iframe width="100%" height="550" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/?ie=UTF8&amp;t=m&amp;ll=26.180782,50.509&amp;spn=0.018486,0.027466&amp;z=15&amp;output=embed"></iframe>

这是我要在地图上标记的位置的图像:

http://img35.imageshack.us/img35/7789/jm8i.png

在 maps.google.com 中,我尝试使用我的场所 > 创建地图选项,该选项有效,但嵌入它也显示编辑菜单(图层选项..等),我无法调整缩放级别,所以它没有没有按照我想要的方式工作,我希望它看起来就像添加了标记的图像。

AFAIK,您可以在谷歌地图上正式添加您公司的详细信息,但这需要验证,这可能需要 2 周多的时间,而且公司所有者有点急于启动该网站,所以我现在需要一个快速的解决方案。

任何帮助将不胜感激!

【问题讨论】:

标签: javascript html css google-maps google-maps-markers


【解决方案1】:

你可以试试http://www.embed-google-map.com/。这是我用来为网站生成嵌入式 iframe 地图的方法。

【讨论】:

    【解决方案2】:

    如果您使用iframe 中的 URL:

    https://maps.google.com/?ie=UTF8&amp;t=m&amp;ll=26.180782,50.509&amp;spn=0.018486,0.027466&amp;z=15&amp;output=embed
    

    并将ll= 更改为daddr=,这会将路线搜索的终点设置为= 之后的坐标。

    所以你的iframe 代码现在是:

    <iframe width="100%" height="550" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/?ie=UTF8&amp;t=m&amp;daddr=26.180782,50.509&amp;spn=0.018486,0.027466&amp;z=15&amp;output=embed"></iframe>
    

    DEMO

    这会将标准绿色标记添加到您的地图中。坐标似乎有点错误(见下图),但希望这会有所帮助。

    【讨论】:

      【解决方案3】:

      Google 静态地图听起来是您的最佳选择。完整的文档可以在https://developers.google.com/maps/documentation/staticmaps/ 找到。

      你不需要 iframe。只需使用带有适当“src”值的img 标记。 这是您需要的源代码:

      http://maps.googleapis.com/maps/api/staticmap?center=YOUR LAT AND LONG SEPERATED BY COMMA&zoom=DESIRED ZOOM LEVEL&size=DESIRED DIMENSIONS&markers=color:red%7C YOUR LAT AND LONG AGAIN&sensor=false

      示例:

      <img src="https://maps.googleapis.com/maps/api/staticmap?center=26.178019,50.509642&zoom=15&size=600x300&markers=color:red%7C26.178019,50.509642&sensor=false" alt="">
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2017-06-30
        • 1970-01-01
        • 1970-01-01
        • 2013-08-21
        • 1970-01-01
        相关资源
        最近更新 更多