Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我怎样才能获得用户的地理位置,他所在的地方的名称,而不是坐标,然后将它们发布在文本框中,比如雅虎天气。
谢谢。
您可以使用 HTML5 地理位置来获取用户的位置。结果将是纬度和经度。
接下来,构造 URL 以传递给 Yahoo 的 Placefinder API,如下所示:
var geoAPI = 'http://where.yahooapis.com/geocode?location='+lat+','+lon+'&flags=J&gflags=R&appid='+APPID;
我希望这有帮助。