是什么这两谷歌地图API地址解析URL之间的区别? [英] What is the difference between this two Google Maps Geocoding API URL?

查看:404
本文介绍了是什么这两谷歌地图API地址解析URL之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,在那里我只需要通过这里给出的地址获取经纬度是两个不同的版本,我用谷歌地图API地址解析URL,它输出几乎相同的结果。

<$p$p><$c$c>http://maps.google.com/maps/geo?output=xml&key=MyApiKey&oe=utf-8&q=Bhatkal,%2CKarnataka,%2CIndiahttp://maps.googleapis.com/maps/api/geo$c$c/xml?sensor=false&address=Bhatkal,%2CKarnataka%2C,India

第一个是API密钥和没有API密钥的第二个。我想知道


  

一)为什么我需要使用API​​密钥
  当我可以不提取结果
  定义键。


  
  

B)哪一个是比较可行的API
  我只是取纬度的目的
  和经度..



解决方案

第一个URL是的地理编码API 的V2,第二个是的 V3

V2


  • 现在,是德precated

  • 需要一个API密钥

  • 有JSONP(无证)的支持



  1. 使用哪一个取决于(至少部分地)你打算在使用它什么样的环境 - 如果你想在使用JavaScript的网页使用它,你将不得不使用V2,因为它有JSONP支持(除非你想添加一个服务器端组件来解决跨域问题)。 JavaScript的另一种方法是将的JavaScript API地理codeR服务


  2. 如果您使用的API在一个桌面应用程序或服务器端,您可以使用,但V3将建议。


  3. V3还拥有更高的查询限制(每天2500个请求)相比,V2(每天1500请求)


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

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

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

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

解决方案

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

v2

  • is now deprecated
  • requires an API key
  • has (undocumented) support for JSONP

  1. Which one to use depends (at least in part) on what environment you're going to use it in - if you want to use it in a webpage with JavaScript, you'll have to use v2 since it has JSONP support (unless you want to add a server-side component to get around cross-domain issues). An alternative for JavaScript is the JavaScript API Geocoder service.

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

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

这篇关于是什么这两谷歌地图API地址解析URL之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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