在自定义 Google 地图中添加按邮政编码搜索
首先我想说,我是这个网站的新手,从未使用过 Google Maps API,并且对 JavaScript 有一定的了解。
我做了什么: 我通过向 Google“我的地图”添加位置来组合自定义“商店定位器”。 然后,我创建了一个带有下拉菜单的网页,根据您从下拉菜单中选择的位置,它会更改保存地图的 iFrame 的 SRC。 因此,当页面加载时,您会看到更大比例的地图,并且通过选择特定位置,它会将地图更改为该特定位置(缩放和裁剪)。
我需要做什么: 现在要完成此地图,我需要做的是添加“按邮政编码搜索”,这将允许用户输入邮政编码,并使网页返回最近位置的列表以及希望它们的距离。
有人知道我是否能够将“按邮政编码搜索”功能添加到我的自定义 Google 地图中吗?
我的代码确实没有太多要发布的内容,但如果有帮助,我很乐意这样做。 我的地图的当前功能运行良好,问题是我不知道从哪里开始添加邮政编码搜索。
这是我引用的页面的链接: http://74.53.82.155/store-locator .htm
感谢任何帮助。
提前致谢, 混沌
First I would like to say that I am new to this site, never worked with Google Maps API and have an intermediate knowledge of JavaScript.
What I have done:
I put together a custom 'store locator' by adding locations to a Google 'my maps'. I then created a web page with a drop down menu and depending on the location you select from the drop down, it changes the the SRC for the iFrame holding the map. So when the page loads you see a larger scale map and by selecting specific locations, it will change the map to that specific location (zoom and crop).
What I need to do:
What I need to do now to complete this map is to add a 'search by zip code' which will allow the user to put in their zip code and have the web page return a list of the closest locations and hopefully their distances.
Does anyone have an idea if I will be able to add the 'search by zip' functionality to my custom Google map?
There really isn't much to my code to post, but if it will help, I'll gladly do so. The current functionality of my map works great, the problem is that I don't know where to begin adding the zip code search.
Here is a link to the page that I am referring to: http://74.53.82.155/store-locator.htm
Any help is appreciated.
Thanks in advance,
gnrlchaos
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一种选择是使用 geonames Web 服务,该服务根据邮政编码返回位置。 下面是如何通过 dojo 使用该 Web 服务的快速示例。
One option is to use the geonames web service that returns locations from zip codes. Here's a quick example of how to use that web service with dojo.
我不知道有什么方法可以按照您想要的方式与嵌入式 Google 地图进行交互。 最好的选择是使用 Google Maps API 创建您自己的地图。 Google 有一些很棒的文档和示例帮助您入门。
I don't know of any way to interact with an embedded Google Map in the way that you want. The best option would be to create your own map with the Google Maps API. Google has some great documentation and examples to get you started.
嘿,我也在进行类似的搜索。 我在这里找到了有关数学的很好的讨论,以及查询和公式的链接:http:// /uclue.com/?xq=2861。 希望这可以帮助。
hey, i'm working on a similar search too. i found a pretty good discussion of the math involved, as well as links to queries and formulas, here: http://uclue.com/?xq=2861. hope this helps.