问题标签 [overpass-api]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
119 浏览

javascript - What is the expected input for uninterestingTags in osmtogeojson?

I am currently working with Leaflet.js and Overpass API and I am using osmtogeojson to do the format change between the OSM-JSON that Overpass API outputs and the GeoJSON that Leaflet.js needs as input. To do so I am using the following code:

This works perfectly.

Here comes the problem: I am trying to ignore some data that I am getting on the OSM-JSON dataset. So I am trying to use uninterestingTags as given in the osmtogeojson API. The thing is that I don't know how to code this thing. This is not working:

0 投票
1 回答
2487 浏览

overpass-api - 防止 Overpass API 返回节点并仅显示方式

我试图让所有的道路都围绕某个点。我正在使用以下查询:

我添加了crossing排除项,因为它一直包含交叉路口的“标记”,而且我只对道路感兴趣。

然而,它似乎忽略了交叉路口并仍在地图上绘制标记,而不仅仅是显示道路轮廓。这可以在这里看到

这些我不想要的“节点”有标签:

这应该使我的正则表达式查询失败,但事实并非如此。

如何让它只返回道路情节线,而没有这些节点/标记?

抱歉,如果我的术语全错了,我对此很陌生

0 投票
1 回答
3045 浏览

overpass-api - 如何找到一个点周围的所有节点,这些节点是具有特定标签的方式的成员?

我想找到一定半径内的所有高速公路成员节点。如果不使用交集,我看不到如何做到这一点,但是,这不在 API 中。例如我有这个:

结果集.a包含我想要的节点,但也包含半径之外的节点 - 如果路径很长,可能会很大。正如上面的完整查询所返回的,我可以找到我不需要的半径内的所有节点。现在我总是可以执行第二个around查询,并在 Overpass 之外对两个结果集进行交集。或者我可以做另一个不同的事情:

这给出了我想要的结果,但可以简化吗?我确定我在这里遗漏了一些东西。

0 投票
1 回答
198 浏览

openstreetmap - 使用 Overpass API 在 OpenStreetMap 中分组节点

Hy.I 想查询某个区域的节点。例如:如何获取给定区域(例如行政边界 - 国家)的所有节点(例如峰)。

类似于 SQL 中的连接:SELECT n.*, a.name from node n LEFT JOIN area a ON n.area_id = a.id WHERE n.type = "peak"

结果将类似于:

或者可能:

这甚至可能吗?还是我应该先对所有区域进行 1 次查询,然后对每个区域进行另一次查询?

0 投票
1 回答
742 浏览

openstreetmap - 立交关系铁路段

我想查询Overpass Api以找出特殊关系(铁路)的距离。请求很好,并返回我所有relation感兴趣waynode对象。汉堡示例:

在 Overpass 中,每个relation对象都有定义这种关系的成员。对于way对象,您可以解析其node属性的纬度/经度并以此方式计算距离。如果你总结所有的距离,它似乎是合理的。

但是,relation该类型的成员node(大多数情况下,他们有一个role“停止”)似乎代表了该类型的正确停止顺序relation。但不是在成员之间,他们大致在最后。如果我尝试查看道路内部的停靠点,它们并不都存在。我应该如何计算两个特定站点之间的距离?

0 投票
1 回答
2115 浏览

geolocation - Overpass api查找坐标的限速?

我收到一辆车的坐标,我需要找出这辆车所在道路的限速?我知道你可以找到像这样的某个有界框的 maxspeed

www.overpass-api.de/api/xapi? [最大速度= ][bbox=5.6283473,50.5348043,5.6285261,50.534884]

但那是如果这个有界框区域只有一个速度限制。那么假设有一个区域在有界框内有两个限速?

我的第二个问题是我应该如何制作有界框,因为我一次只得到一个坐标?

0 投票
1 回答
658 浏览

ios - Overpass-API iOS 示例

我不知道如何向 Overpass-API 的发布请求添加参数。要创建请求,我正在使用 AFNetworking。

1) 一开始,我在 overpass-turbo.eu 中构建查询,而不是将其导出到 XML,所以我得到了这个

<osm-script> <query type="node"> <has-kv k="amenity" v="drinking_water"/> <bbox-query e="12.51119613647461" n="41.89248629819397" s="41.88659196260802" w="12.488558292388916"/> </query> <print/> </osm-script>

并将其放入 NSString

2) 比我尝试构建参数 AFNetworking - 如何在不使用键值对的情况下 PUT 和 POST 原始数据?

所以我创建了 NSData 类别方法 base64DataFromString 可用here

并创建我的请求

3)但现在我得到错误

Error: Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: bad request (400)" UserInfo=0x1700fc680 {NSUnderlyingError=0x170247290 "Request failed: unacceptable content-type: text/html", com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x170230860> { URL: http://overpass-api.de/api/interpreter } { status code: 400, headers { Connection = close; "Content-Encoding" = gzip; "Content-Length" = 491; "Content-Type" = "text/html; charset=utf-8"; Date = "Sat, 13 Dec 2014 13:25:37 GMT"; Server = "Apache/2.2.22 (Ubuntu)"; Vary = "Accept-Encoding"; } }, NSErrorFailingURLKey=http://overpass-api.de/api/interpreter, com.alamofire.serialization.response.error.data=<...

我做错了什么?

0 投票
1 回答
3624 浏览

openstreetmap - Getting Streets of a specific postcode using Open Street Maps

I want to write a code that has the Countrycode and Postcode as an input and the ouput are the streets that are in the given postcode using some apis that use GSM.

My tactic is as follows:

  1. I need to get the relation Id of the district. For Example 1991416 is the relation id for the third district in Vienna - Austria. It's provided by the nominatim api: http://nominatim.openstreetmap.org/details.php?place_id=158947085

  2. Put the id in this api url: http://polygons.openstreetmap.fr/get_wkt.py?id=1991416&params=0

  3. After downloading the polygon I can put the gathered polygon in this query on the overpass api

    ( way (poly: "polygone data") ["highway"~"^(primary|secondary|tertiary|residential)$"] ["name"];

    ); out geom;

And this gives me the streets of the searched district. My two problems with this solution are 1. that it takes quite a time, because asking three different APIs per request isn't that easy on ressources and 2. I don't know how to gather the relation Id from step one automatically. When I enter a Nominatim query like http:// nominatim.openstreetmap.org/search?format=json&country=austria&postalcode=1030 I just get various point in the district, but not the relation id of the searched district in order to get the desired polygone.

So my questions are if someone can tell my how I can get the relation_Id in order to do the mentioned workflow or if there is another, maybe better way to work this issue out.

Thank you for your help!

Best Regards Daniel

0 投票
1 回答
697 浏览

api - Is there a way to get the middle of a way from Overpass API?

I´m trying to import several Ways and Nodes from the OSM. But i dont want to get the Ways as a way with different nodes, only the middle of the way.

In my case, all ways are an area (Parks, Parking etc.) and i only need one point - the middle of the area. I could calculate this after the request, but maybe theres a more elegant way?

0 投票
1 回答
901 浏览

polygon - 如何使用 Overpass API 获取给定街道的多边形?

我想使用 OverPass API 获取给定街道的多边形。例如,当我使用时,

这是 Overpass Turbo 链接:Overpass Turbo

我得到了多边形的节点,但它们的顺序不正确。所以我不能将它们保存为一行。有没有更好的可能性?我遇到的另一个问题是我想限制对给定城市的搜索,例如"addr:city"="Vienna"。由于节点没有直接的城市属性,我如何编写查询来获取此信息?