Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
660 views
in Technique[技术] by (71.8m points)

geolocation - Country name for GPS coordinates

Is there an easy way to get the name of the country on whose territory a given point is located?

I don't care too much about accuracy nor about ambiguities given by political disputes. Just need a good enough approximation.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

EDIT: The Yahoo Where API is no longer available.

Try the Yahoo! APIs.

Latitude and Longitude

Latitude and longitude can be specified for the location parameter. Latitude and longitude may be expressed as decimal degrees or degrees-minutes-seconds, with either leading or trailing directionals or leading signs. If directionals are provided, longitude may appear before latitude. If directionals are not provided, longitude may appear before latitude if it is outside the range -90 to 90. Otherwise, the latitude must appear first. Punctuation marks (commas, degrees, minutes, seconds) are ignored.

Examples: 

?50.3 -120.5
?50.3, -120.5
?-120.5 50.3
?50.3 N 120.5 W
?120.5 W 50.3 N
?50 18 0 -120 30 0
?50 18 0 N 120 30 0 W
?50° 18' 0" N 120° 30' 0" W

The response element will give you the country, as well as many other elements.

Don't forget to send as parameter gflags=R, to make the reverse geocoding. If you want the output in json, send the parameter flags=J as well.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...