这两个 Google Maps Geocoding API URL 有什么区别? [英] What is the difference between this two Google Maps Geocoding API URL?

查看:34
本文介绍了这两个 Google Maps Geocoding API URL 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,我只需要通过在此处提供地址来获取纬度和经度,这是我使用的两个不同版本的 Google Maps Geocoding API URL,它们输出的结果几乎相同.

i have a requirement where i just need to fetch the Latitude and Longitude by giving address here is the two different versions of Google Maps Geocoding API URL i used which outputs almost the same result.

http://maps.google.com/maps/geo?output=xml&key=MyApiKey&oe=utf-8&q=Bhatkal,%2CKarnataka,%2CIndia

http://maps.googleapis.com/maps/api/geocode/xml?sensor=false&address=Bhatkal,%2CKarnataka%2C,India

第一个带有 API 密钥,第二个没有 API 密钥.我想知道

the first one is with API Key and the Second one without the API Key. i would like to know

a) 为什么我需要使用 API 密钥当我可以在没有的情况下获取结果时定义密钥.

a) Why do i need to use the API key when i could fetch the result without defining the key.

b) 哪个 API 更可行我只是获取纬度的目的和经度..

b) Which one is more feasible API for my Purpose of just fetching latitude and longitude..

推荐答案

第一个 URL 用于 v2 的地理编码 API,第二个用于 v3.

The first URL is for v2 of the Geocoding API, the second is for v3.

v2

  • 现已弃用
  • 需要 API 密钥
  • 具有(未记录的)对 JSONP 的支持
  1. 使用哪个取决于(至少部分地)您将在什么环境中使用它 - 如果您想在带有 JavaScript 的网页中使用它,则必须使用 v2,因为它具有 JSONP 支持(除非您想添加服务器端组件来解决跨域问题).JavaScript 的替代方案是 JavaScript API Geocoder 服务.

如果您在桌面应用程序或服务器端使用 API,您可以使用其中之一,但建议使用 v3.

If you're using the API in a desktop app or on the server-side, you can use either but v3 would be recommended.

与 v2(每天 1500 个请求)相比,v3 还具有更高的查询限制(每天 2500 个请求)

v3 also has a higher query limit (2500 requests per day) as compared to v2 (1500 requests per day)

这篇关于这两个 Google Maps Geocoding API URL 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆