Google Fusion Table - 邻近搜索
我可能已经陷入困境,正在寻求任何可能的帮助,因为我真的不熟悉编写代码。如果你能简化任何可能的答案,那就太棒了。
我创建了一个 Google Fusion Table,其中按城市和国家列出了全球海港,并在地图上将它们可视化。我希望能够输入内陆位置并让地图标记该位置,并建议最近的一两个海港。
例如:我输入弗吉尼亚州里士满的位置,地图将在地图上标记弗吉尼亚州里士满,并建议弗吉尼亚州诺福克和纽约州纽约海港最近。
我不知道从哪里开始来完成这个任务。这个问题是不是太模糊了?提供的任何帮助将不胜感激!
I might have gotten in over my head here, and am looking for any possible assistance, as I am really not familiar with writing code. If you can dumb down any possible answers, that'd be spectacular.
I created a Google Fusion Table that lists worldwide sea ports by city and country, and visualizes them on a map. I want to have the ability to type in an inland location and have the map mark the location, and advise the closest one or two seaports.
For example: I enter a location of Richmond, VA, and the map will mark Richmond, VA on the map, and advise that the Norfolk, VA and New York, NY sea ports would be closest.
I'm not sure where to begin to accomplish this. Is this too vague of a question? Any help provided will be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用一些 JavaScript 代码来完成此操作。 Google Maps API 中的 Fusion Tables 图层允许您查找距纬度、经度坐标最近的 n 个邻居。可以在此处找到示例:
https://developers.google.com/fusiontables/docs /samples/nn_example
以下是创建应用程序所需的总体步骤:
创建一个 HTML 页面,其中包含搜索框和地图,其中 Fusion Table Layer 显示表中的数据
当用户输入搜索词(例如 Richmond VA)时,您将对字符串进行地理编码以获取纬度/经度协调。您可以使用 Google Maps API 地理编码服务:
http://code.google.com/apis/maps /documentation/javascript/geocoding.html
当您获取纬度/经度坐标时,使用它来更新发送到 Fusion Tables 层的查询(类似于上面的示例)到显示最近的 2 个端口。
You can accomplish this using a bit of JavaScript code. The Fusion Tables Layer in the Google Maps API allows you to find the nearest n neighbors to a latitude, longitude coordinate. An example can be found here:
https://developers.google.com/fusiontables/docs/samples/nn_example
Here are the overall steps you would take to create the app:
Create an HTML page that has a search box plus a map with the Fusion Table Layer displaying the data from your table
When the user enters a search term, such as Richmond VA, you would geocode the string to get the lat/lon coordinate. You can use the Google Maps API geocoding service:
http://code.google.com/apis/maps/documentation/javascript/geocoding.html
When you get the lat/lon coordinate, use this to update the query sent to the Fusion Tables Layer (similar to the example above) to show the 2 nearest ports.