Using Latitude & Longitude to get a place with Yahoo
I am using Google Map API to add markers to a map when the user clicks a location on the map. I want to add an info window for the new marker when its clicked, the info window will be populated with details of the location. The Google map API returns the latit开发者_JAVA百科ude and longitude so I just need a way of taking this info and getting a location.
Is it possible to use Latitude & Longitude with Yahoo Geo Technologies to pinpoint a city or town?
Using YQL, u can obtain a list of possible forecast First step: Reverse geocoding
SELECT woeid
FROM geo.places
WHERE text="##LATITUDE##, ##LONGITUDE##"
then apply a filter to order results by placeType. This help U to order forecast by map level accuracy (town, city, postal code, region, ....)
SELECT woeid
FROM geo.places
WHERE text="##LATITUDE##, ##LONGITUDE##" |
SORT(field="placeTypeName.code")
Now use simile join to get all forecasts by woeid resulted by last query and filter null results
SELECT channel
FROM weather.woeid
WHERE w in (
SELECT woeid
FROM geo.places
WHERE text="##LATITUDE##, ##LONGITUDE##" |
SORT(field="placeTypeName.code"))
AND channel.location IS NOT NULL and u="c"
Google has a reverse geocoder, you should use that. why do you need yahoo for that?
http://code.google.com/apis/maps/documentation/services.html#ReverseGeocoding
精彩评论