嵌入带有搜索栏的Google Map [英] Embed Google Map with search bar

查看:56
本文介绍了嵌入带有搜索栏的Google Map的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个带有搜索框的Google地图,以嵌入到我的网站中.我已经通过Google地图帐户用标记创建了自定义地图.

I'd like to create a Google map with a search box to embed into my site. I've already created the custom map with my markers via my google maps account.

不幸的是,HTML嵌入式地图在地图内未包含搜索框,因此我认为我需要Google API.我只需要一张带有搜索框并缩放的地图(默认情况下会显示缩放"),这样我就可以从Google帐户中添加名胜古迹(以我的俱乐部为例).我希望访问者能够在搜索框中输入景点,它将带他们到地图上的那个位置,并在附近显示当地俱乐部.

Unfortunately the html embedded maps don't include a search box within a map, so I believe I need the Google API. All I need a map with a search box and zoom (zoom seems there by default), so that I can add places of interest (clubs in my case) from my Google account. I would like visitors to be able to type a place of interest in the search box, and it will take them to that location on the map, and show local clubs nearby.

我已经花了一些时间来查找示例,以便我可以对其进行修改以适合我的需要,但是还没有找到类似的东西.我的编程技能非常有限,因此我正在寻找一个简单的解决方案.

I've already spent some time looking for examples, so that I can modify it to suit my needs, but have not found something similar. My programming skills are quite limited, so I'm looking for a simple solution.

有人可以在这里向我指出正确的方向吗?

Can anyone point me in the right direction here please?

推荐答案

这可能会帮助其他用户抢先一步.我编写了一个脚本,该脚本具有两个带有Google地点搜索自动完成功能的搜索框,然后它计算路线并显示在地图上.

This might help another users for head start. I have written a script that has two search boxes with Google place search auto completion and then It calculates the route and shows on the map.

下面是示例链接.(只需下载并在浏览器中打开)

Below is example link. (just download it and open in browser)

Google地方搜索&计算两个位置之间的路线

这篇关于嵌入带有搜索栏的Google Map的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆