Google我的地图:如何从网络链接的KML文件导出坐标? [英] Google My Maps: How can I export coordinates from a network-linked KML file?

查看:299
本文介绍了Google我的地图:如何从网络链接的KML文件导出坐标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在检查Google的我的地图服务的文档,但我无法弄清楚它是否会让我做我需要做的事。

I've been checking out the documentation for Google's "My Maps" service, and I can't figure out if it will let me do what I need to do.

我们的客户拥有一张使用我的地图创建的地图,该地图使用彩色多边形定义了多个投放区域。我知道可以导出包含这些多边形坐标的KML文件,也可以创建一个网络链接,以便在映射时更新所述KML文件。

Our client has a map, created using My Maps, that defines several delivery areas using colored polygons. I understand that it's possible to export a KML file containing the coordinates for these polygons, and that it's also possible to create a network link so said KML file will be updated whenever the map is.

我的问题:我不知道该如何处理KML文件。我需要某种脚本,可以使用网络链接的KML,并返回一组人类可读的坐标,我可以使用这些坐标来定义客户站点上的交付区域。 换句话说,他们需要能够在此地图上编辑或创建交货区域,然后在其网站上将每个多边形绑定到特定商店,以确定哪个商店必须交付哪些订单。有很多复杂的东西在这里进行,但对于第一步,我只需要知道如何以可靠的方式获得单独形状的坐标。

My problem: I don't know what to actually do with the KML file. I need some sort of script that can take the network-linked KML, and return a human-readable set of coordinates that I can use to define delivery areas on the client's site. In other words, they need to be able to edit or create delivery zones on this map, then on their site, bind each polygon to a particular store to determine which store must deliver which orders. There's a lot of complicated stuff going on here, but for this first step I just need to know how to get the coordinates for the separate shapes in a reliable way.

我希望我有一些代码发布,以使其成为一个更有用的帖子,但它更多的是这种类型的功能是否实际上是可能的问题。请帮我解决这个问题!

I wish I had some code to post to make this a more useful post, but it's more a question of whether or not this type of functionality is actually possible. Please help me figure this out!

感谢您的任何帮助和帮助。

Thanks for any and all help.

推荐答案

KML文件是一个XML文件,然后您可以通过JQuery检查服务器端的XML解析器或客户端。

The KML file is a XML file then you can inspect the file both server side with a XML parser or client side via JQuery.

这是客户端必要的javascript样本:

this is an essential javascript sample for a client side approch:

var request = new XMLHttpRequest();
request.open("GET", filename, false); // filename = kml_filename

 xmlDocObj = $($.parseXML(request.responseText));  

 var placemarks = xmlDocObj.find("Placemark");
 placemarks.each(function (index) {

 ... your parsing for the geometry object and coordinates content you need

}

这篇关于Google我的地图:如何从网络链接的KML文件导出坐标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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