如何创建在 KML 内搜索并在 Google 地图 v3 上显示结果的搜索?
我创建了一个 Google 地图,它将 KML 文件加载为叠加层。这是一张徒步旅行路线起点的地图。我现在想要弄清楚的是如何创建一个搜索,允许访问者在 KML 数据中进行搜索,并在 Google 地图上将相关的路径起点显示为结果。这可能吗?我有一个谷歌搜索,可以让他们搜索地址,但这不会在 KML 文件的数据中搜索线索。
理想情况下,访问者可以输入一个地址,例如 12345 Main st., Chicago, IL 等,它将显示该地址指定附近(例如 10 英里)内的结果(即纬度、经度)。
我什至不知道从哪里开始。
感谢您的帮助!
戴维斯
I've created a Google map that loads a KML file as an overlay. It is a map of trailheads for say hiking. What I'm trying to figure out now is how to create a search that will allow visitors to search within the KML's data and show the relevant trailhead/s as results on the Google Map. Is this possible? I have a google search that will let them search for an address, but this does NOT search within the KML file's data for a trailhead.
Ideally the visitor could input an address, say 12345 Main st., Chicago, IL, or something and it would display results that are within a specified vicinity, say ten miles, of that address (ie latitude, longitude).
I'm a little lost as to even where to begin.
thanks for your help!
Davis
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不知道您的 kml 文件更新的频率,但我建议将所有 kml 数据也存储在数据库中,以使这更容易。也许每隔一段时间重新下载 kml 文件并更新数据库。
然后,就像使用 haversine 公式 并在数据库中搜索附近的路径一样简单。
I don't know how often your kml file updates, but i recommend storing all the kml data in a database as well to make this easier. Maybe every once in a while re-download the kml file and update the database.
Then its as simple as using the haversine formula and searching the database for nearby trails.
您所描述的内容听起来对于 融合表。 Fusion Tables 为您提供了一种存储和编辑数据(甚至协作)的好方法。此外,您还可以添加地理空间列/数据字段(也称为“位置”列,可以是地址或纬度/经度坐标)。将所有路径头放入您的融合表中,您就可以绘制它们。让人们输入地址或纬度/经度,您可以查询融合表以显示该点的用户指定距离内的所有路径头。请参阅教程以开始使用。
What you're describing sounds like a good job for Fusion Tables. Fusion Tables give you a nice way to store and edit the data (even collaboratively). In addition, there are geospatial columns/data fields you can add (aka, a "Location" column that can be address or lat/long coordinates). Put all the trail heads in your fusion table and you can map them. Let people enter an address or lat/long, and you can query the fusion table to show all trail heads within the user specified distance of that point. See the tutorials to get started.
您可以使用 KML 搜索工具来执行此操作。它支持 KML KMZ CSV 和 GPX。您可以在此处找到该工具
You can use KML search tool to do this. It supports KML KMZ CSV and GPX. You can find the tool here