0
我做一個簡單的Web應用程序在用戶輸入WOEID並繪製在地圖上的位置。我目前使用谷歌地圖API而據我所知它不支持WOEID繪圖,所以我試圖找到一種簡單的方式來獲得緯度/液化天然氣從WOEID座標。我知道雅虎的PlaceFinder應該可以工作,但是它的設計是針對Lat/Lng而不是其他方式。WOEID到緯度,經度
有一個簡單的方法來從WOEID得到緯度/經度?
我做一個簡單的Web應用程序在用戶輸入WOEID並繪製在地圖上的位置。我目前使用谷歌地圖API而據我所知它不支持WOEID繪圖,所以我試圖找到一種簡單的方式來獲得緯度/液化天然氣從WOEID座標。我知道雅虎的PlaceFinder應該可以工作,但是它的設計是針對Lat/Lng而不是其他方式。WOEID到緯度,經度
有一個簡單的方法來從WOEID得到緯度/經度?
您可以從雅虎直接將緯度/長。
的docs表明,經/緯在XML響應中返回。
<?xml version="1.0" encoding="UTF-8"?>
<place yahoo:uri="http://where.yahooapis.com/v1/place/2507854" xml:lang="en">
<woeid>2507854</woeid>
<placeTypeName code="7">Town</placeTypeName>
<name>Trenton</name>
<country type="Country" code="US">United States</country>
<admin1 type="State" code="NJ">New Jersey</admin1>
<admin2 type="County" code="">Mercer</admin2>
<admin3/>
<locality1>Trenton</locality1>
<locality2/>
<postal/>
<centroid>
<latitude>40.21777</latitude>
<longitude>-74.759361</longitude>
</centroid>
<boundingBox>
<southWest>
<latitude>40.183868</latitude>
<longitude>-74.819519</longitude>
</southWest>
<northEast>
<latitude>40.248291</latitude>
<longitude>-74.728798</longitude>
</northEast>
</boundingBox>
</place>
事情你感興趣的可能是centroid
元素。現在
在這個答案中使用的鏈接已被取消,但你仍然可以查詢W /通過[query.yahooapis.com]一個WOEID(https://query.yahooapis.com/v1/public/yql?q=select+ * + +從+ geo.places其中+ WOEID =%272507854%27) – Napoli