OverPass API - SpeedLimit around a co-ordinates

ぐ巨炮叔叔 提交于 2019-12-04 04:01:03

问题


We are developing an application, that needs to find the speed around a specific location... We were planning to use OverPass API to first the speed and tried to follow the article mentioned below.

Overpass api to find the speed limit for a co-ordinate?

The syntax of the around method is shown below.

http://www.overpass-api.de/api/xapi?*[maxspeed=*][around=2500,8.5580957,76.880541]

But we are not getting any results... Can anyone guide us if the syntax is correct?


回答1:


The failure reason: around is not a supported predicate in XAPI (please, see the original manual, https://wiki.openstreetmap.org/wiki/Xapi). So you cannot use it in your queries.

Solution 1: You can replace around with supported bbox. For example, the query below works properly.

http://www.overpass-api.de/api/xapi?*[bbox=-0.489,51.28,-0.436,51.36][maxspeed=*]

You will receive ~300kB of data

Solution 2: If you still want around, please use Overpass QL/XML:

  • Overpass QL query: way(around:2500,8.5580957,76.880541)[maxspeed];out;. You can try it at http://www.overpass-api.de/query_form.html
  • Overpass XML query:

    <query type="way">
       <around radius="2500" lat="8.5580957" lon="76.880541" />
       <has-kv k="maxspeed" />
    </query>
    

    You can try it at http://overpass-turbo.eu/.

As for me, Overpass XML looks like more readable. Also XML is preferred because XSLT can transform it to any other regular format.



来源:https://stackoverflow.com/questions/34860208/overpass-api-speedlimit-around-a-co-ordinates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!