简体   繁体   English

Google Maps Geolocation API的替代品

[英]Alternative to Google Maps Geolocation API

I'm working on a project that involves a huge volume of real time data per second (achieved by websockets). 我正在开发一个每秒钟涉及大量实时数据的项目(通过websockets实现)。 Because of this, it can't handle calling Google's API to convert a City + Region to a longlat coordinate. 因此,它无法处理调用Google的API以将City + Region转换为longlat坐标。 I'm getting about a 1 to 100 success rate. 我的成功率约为1到100。 Is there an unlimited alternative to City & Region to Coordinate service of the Google API? 是否有无限制的城市和区域替代方案来协调Google API的服务? Ideally a locally stored JSON array of such data? 理想情况下,本地存储此类数据的JSON数组?

You can use a service provided by Yahoo called YQL. 您可以使用Yahoo提供的名为YQL的服务。 This service is free for a limited number of requests, up to 100,000 per day. 此服务仅限数量有限,每天最多100,000次。 Then you can retrieve the latitude and longitude out of the response XML at query/results/place/centroid . 然后,您可以在query/results/place/centroid中从响应XML中检索纬度和经度。

One thing I've noticed with this service is the city names need to be exact, and it is possible for there to be multiple results. 我注意到这项服务的一件事是城市名称需要精确,并且可能会有多个结果。

http://developer.yahoo.com/yql/ http://developer.yahoo.com/yql/

Example YQL query: 示例YQL查询:

http://query.yahooapis.com/v1/public/yql?q=SELECT * FROM geo.places WHERE text="Seattle" and placeTypeName = "Town"

Response XML: 响应XML:

<?xml version="1.0" encoding="UTF-8"?>
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="1" yahoo:created="2012-07-09T16:20:40Z" yahoo:lang="en-US">
  <results>
    <place xmlns="http://where.yahooapis.com/v1/schema.rng" xml:lang="en-US" yahoo:uri="http://where.yahooapis.com/v1/place/2490383">
      <woeid>2490383</woeid>
      <placeTypeName code="7">Town</placeTypeName>
      <name>Seattle</name>
      <country code="US" type="Country">United States</country>
      <admin1 code="US-WA" type="State">Washington</admin1>
      <admin2 code="" type="County">King</admin2>
      <admin3/>
      <locality1 type="Town">Seattle</locality1>
      <locality2/>
      <postal/>
      <centroid>
        <latitude>47.603561</latitude>
        <longitude>-122.329437</longitude>
      </centroid>
      <boundingBox>
        <southWest>
          <latitude>47.422359</latitude>
          <longitude>-122.472153</longitude>
        </southWest>
        <northEast>
          <latitude>47.745071</latitude>
          <longitude>-122.176193</longitude>
        </northEast>
      </boundingBox>
      <areaRank>6</areaRank>
      <popRank>12</popRank>
    </place>
  </results>
</query>
<!-- total: 82 -->
<!-- engine5.yql.mud.yahoo.com -->

Have a look at datasciencetoolkit.org. 看看datasciencetoolkit.org。 They offer a VM image/AMI that you can host on EC2 and make geolocation calls to your own server and hence no API limits. 它们提供可以在EC2上托管的VM映像/ AMI,并对您自己的服务器进行地理定位调用,因此没有API限制。

Then there's also Yahoo's geolocation API which has higher limits than Google's. 然后还有雅虎的地理位置API,其限制比谷歌更高。

Usually when you're dealing with a large number of data points, you'd geocode them once on the server. 通常,当您处理大量数据点时,您需要在服务器上对它们进行一次地理编码。 Then you can stream the lat/longs to your clients ready to use. 然后,您可以将lat / long流式传输到准备使用的客户端。

Google has a Geocoding web service you can use from your server, but there's a request limit of 2,500/day. Google可以在您的服务器上使用Geocoding Web服务 ,但请求限制为每天2,500。 If that won't work, you can also look in to OSM 's Nominatim; 如果这不起作用,你也可以查看OSM的Nominatim; Mapquest hosts a web service with no limits. Mapquest服务主机没有限制的网络服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM