XQuery :使用谷歌地图API从经度/纬度获取地址/城镇



我知道我可以通过将 [A] 和 [B] 替换为纬度和经度来获取从此 URL 返回地理信息的 XML 文件。

http://maps.googleapis.com/maps/api/geocode/xml?latlng=[A],[B]&sensor=true

现在我想知道的是如何从我的 .xqy 文件中调用此 URL,并简单地获取 XML 文件中地址和城镇属性的值。知道吗?

您可以使用 expath HTTP 客户端来查询此 API:

import module namespace http = "http://expath.org/ns/http-client";
http:send-request(<http:request method="get" href="http://maps.googleapis.com/maps/api/geocode/xml?latlng=[A],[B]&amp;sensor=true" />)

您可以在 http://www.zorba-xquery.com/html/demo#SYTRRzV6oopDKuEs3hxUdj4lUts= 现场试用此示例

尝试将地理编码服务 API 与反向地理编码结合使用。

https://developers.google.com/maps/documentation/javascript/geocoding#ReverseGeocoding

最新更新