What is a correct overpass-turbo query for getting all streets in a city? - openstreetmap

I want to get all streets in NYC using http://overpass-turbo.eu/. I tried this:
[out:json]; area[name = "New York"]; (node(area)[highway=street]; ); out;
However it returns
{
"version": 0.6,
"generator": "Overpass API 0.7.55.1009 5e627b63",
"osm3s": {
"timestamp_osm_base": "2019-11-13T19:26:03Z",
"timestamp_areas_base": "2019-11-13T18:05:02Z",
"copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
},
"elements": [
]
}
No elements. However this query:
[out:json]; area[name = "New York"]; ( node(area)[amenity=cinema]; node(area)[highway=street]; ); out;
for getting streets and cinemas, works:
{
"version": 0.6,
"generator": "Overpass API 0.7.55.1009 5e627b63",
"osm3s": {
"timestamp_osm_base": "2019-11-13T19:29:02Z",
"timestamp_areas_base": "2019-11-13T18:05:02Z",
"copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
},
"elements": [
{
"type": "node",
"id": 344994897,
"lat": 41.7680892,
"lon": -73.9291000,
"tags": {
"amenity": "cinema",
"created_by": "Potlatch 0.10f",
"name": "Roosevelt Theater"
}
},
...
How should I modify the initial query to get the streets?

There are two errors in your query.
Error 1: highway=street
Where does this tag come from? street is not a valid value for the highway key. In fact, since you want to obtain all streets you have to omit the value completely and just query for highway.
Error 2: node()
A road is not a node but a way. So you have to query for way(area)[...] instead. This also requires a recurse-up step (>;) to retrieve all nodes of these ways.
Corrected query
[out:json]; area[name = "New York"]; (way(area)[highway]; ); (._;>;); out;

Related

can we used world update for France only server ? seems to make wrong query result

On my local overpass api server with only french data on which is applied hourly planet diff, some of the query responses are wrong.
It's not doing it for each query : but something like once every 200 requests , sometime more ...
for example :
[timeout:360][out:json];way(48.359900103518235,5.708088852670471,48.360439696481784,5.708900947329539)[highway];out ;
return 3 ways :
{
"version": 0.6,
"generator": "Overpass API 0.7.54.13 ff15392f",
"osm3s": {
"timestamp_osm_base": "2019-09-23T15:00:00Z",
},
"elements": [
{
"type": "way",
"id": 53290349,
"nodes": [...],
"tags": {
"highway": "secondary",
"maxspeed": "100",
"ref": "L 385"
}
},
{
"type": "way",
"id": 238493649,
"nodes": [...],
"tags": {
"highway": "residential",
"name": "Rue du Stand",
"ref": "C 3",
"source": "..."
}
},
{
"type": "way",
"id": 597978369,
"nodes": [...],
"tags": {
"highway": "service"
}
}
]
}
First one is in Germany, far East ...
My question :
On an overpass api server, is there a way to apply diff only for defined area ? it is not documented ( neither here : https://wiki.openstreetmap.org/wiki/Overpass_API/Installation
or here : https://wiki.openstreetmap.org/wiki/User:Breki/Overpass_API_Installation#Configuring_Diffs )
if not, how to get rid of those wrong results ?
Thanks,
Two questions, so two answer :
i found that there is French diff file existing : http://download.openstreetmap.fr/replication/europe/france/minute/ so i will restart my server with those diffs.
The best way to get rid of those wrong result is to have a consistant server : no world diff for just France Data.

get latitude and longitude from node id in overpass API

I use this query to get the latitude and longitude from node id in overpass API:
[out:json]; (
node(2314028892);
node(30223035);
node(268195434);
node(30223039);
); (._;>;); out;
I get this answer:
{
"version": 0.6,
"generator": "Overpass API 0.7.55.3 9da5e7ae",
"osm3s": {
"timestamp_osm_base": "2018-06-28T07:47:01Z",
"copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
},
"elements": [
{
"type": "node",
"id": 30223035,
"lat": 52.2917680,
"lon": 10.5265481
},
{
"type": "node",
"id": 30223039,
"lat": 52.2894248,
"lon": 10.5268394
},
{
"type": "node",
"id": 268195434,
"lat": 52.2897618,
"lon": 10.5267852
},
{
"type": "node",
"id": 2314028892,
"lat": 52.2919739,
"lon": 10.5265271,
"tags": {
"bus": "yes",
"name": "Rühmer Weg",
"network": "VRB",
"operator": "Braunschweiger Verkehrs-GmbH",
"public_transport": "stop_position",
"ref": "464"
}
}
]
}
It seems that the elements in the answer have another order. I would like to now if I can get the answer in the same order as in the query. (First the node 2314028892, then 30223035, ... )
Anybody has any idea how could I get this done?
Use "out" after each query statement:
[out:json];
node(2314028892);out
node(30223035);out
node(268195434);out;
node(30223039);out;
For performance reasons, I would recommend to do this as post processing step on your end. You already know the correct sequence, so you can easily apply this to the query result. Also, you can specify multiple node id values in a single query:
[out:json]; node(id:2314028892, 30223035, 268195434, 30223039);out;
Side note: you can also leave out (._;>;); in your query. It's not needed in case of nodes.

Tinkerpop Stack Rexster REST API _properties

Technology Stack:
Tinkerpop Stack 2.4 (Rexster HTTP REST Server)
Titan 0.5.4
DynamoDB (AWS)
NodeJS
Goal:
I would like to utilize the Rexster RESTful based API for querying and traversals of my graph database. I am trying to understand the _properties query parameter for filtering results based on Vertex Query syntax.
Result of Vertices Query:
http://localhost:8182/graphs/mygraph/vertices
{
"version": "2.5.0",
"results": [
{
"name": "Frank Stein",
"_id": 25600768,
"_type": "vertex"
},
{
"name": "John Doe",
"_id": 25600512,
"_type": "vertex"
}
],
"totalSize": 2,
"queryTime": 219.86688
}
Result of Edge Query:
http://localhost:8182/graphs/mygraph/vertices
{
"version": "2.5.0",
"results": [
{
"_id": "f8q68-f8phc-4is5-f8pog",
"_type": "edge",
"_outV": 25600512,
"_inV": 25600768,
"_label": "friends"
}
],
"totalSize": 1,
"queryTime": 164.384768
}
Problem:
These URI's do not return what I am assuming I would get returned, always return an empty set.:
Requests:
_http://localhost:8182/graphs/privvy/vertices/25600768/both?properties=[[name,=,"John Doe"]]
_http://localhost:8182/graphs/privvy/vertices/25600768/both?properties=[[name,=,John Doe]]
_http://localhost:8182/graphs/privvy/vertices/25600768/both?properties=[[name,=,(s,"John Doe")]]
_http://localhost:8182/graphs/privvy/vertices/25600768/both?properties=[[name,=,(s,John Doe)]]
Response:
{
"version": "2.5.0",
"results": [],
"totalSize": 0,
"queryTime": 22.641152
}
Additional Information:
The following URI does return a resulting set of adjacent vertices if I just switch the = (equal operator) to the <> (not equal) operator:
Request:
_http://localhost:8182/graphs/privvy/vertices/25600768/both?properties=[[name,<>,"John Doe"]]
Response:
{
"version": "2.5.0",
"results": [
{
"name": "John Doe",
"_id": 25600512,
"_type": "vertex"
}
],
"totalSize": 1,
"queryTime": 17.451008
}
Anyone have any clue where I may be going wrong?
References:
https://github.com/tinkerpop/rexster/wiki/Basic-REST-API
https://github.com/tinkerpop/rexster/wiki/Property-Data-Types (Shows NO EXAMPLES of string use for data type Vertex Queries.)
https://github.com/tinkerpop/blueprints/wiki/Vertex-Query
Thanks Friends!
Tom
In the link you provided, note this section explicitly:
https://github.com/tinkerpop/blueprints/wiki/Vertex-Query#query-use-cases
Note that all the use cases involved "edges". You are trying to do a vertex query over property values on the adjacent vertex of an edge. If you want your query to work that way, you would have to denormalize your data to include the "name" property on the edges.
Note that in my curl request against the default graph below, things work as expected when I build my vertex query against "weight" (and edge property):
$ curl -g "http://localhost:8182/graphs/tinkergraph/vertices/1/out?_properties=[[weight,=,(f,0.4)]]"
{"version":"2.5.0","results":[{"name":"lop","lang":"java","_id":"3","_type":"vertex"}],"totalSize":1,"queryTime":1.070072}

select ways as nodes with way center as node coords

how can I select ways as nodes with way center coords as node coords?
currently my query looks like this:
[out:json];
way
[amenity=drinking_water]
({{bbox}});
out center;
and my data looks like this:
{
"type": "way",
"id": 123,
"center": {
"lat": 1.23,
"lon": 4.56
},
"nodes": [
...
],
"tags": {
"name": "test"
}
}
but I need the data formatted like this:
{
"type": "node",
"id": 123,
"lat": 1.23,
"lon": 4.56,
"tags": {
"name": "test"
}
}
any idea how to convert the data with overpass?
Background:
I like to convert the overpass data to gpi but it seams that gpsbabel can not convert osm ways to waypoints for gpi.
I just get errors like this: osm: Way reference id "123" wasn't listed under nodes!
I guess the problem here is that gpsbabel doesn't understand center in your response. Instead it tries to read all nodes and their coordinates. But your response doesn't include any nodes, just references to them.
You could modify your query to return all necessary nodes, too, instead of only the way's center:
[out:json];
way
[amenity=drinking_water]
({{bbox}});
(._;>;);
out;
This response should then be parsable by gpsbabel but I'm not sure if it is the response you are looking for.

GoodData "Create Report Definition" API Call giving 500 Internal Server Error

I'm trying to create a report definition using the GoodData REST API. I use the following endpoint to invoke the rest call.
"/gdc/md/{project-id}/obj"
When i try to invoke the API call with the following dataset in which the projectId and the userId are valid, it gives me the error with the response code 500.
{
"reportDefinition": {
"content": {
"filters": [],
"format": "grid",
"grid": {
"rows": [],
"columns": [
"metricGroup"
],
"sort": {
"columns": [],
"rows": []
},
"columnWidths": [],
"metrics": [
{
"uri": "/gdc/md/qy48iv4flikdlcwpwioizuip74wt8nb5/obj/63f3cecd2a8d3ce2ec9378381c8f39e3",
"alias": ""
}
]
}
},
"meta": {
"title": "Sample report definition",
"summary": "This is a sample report",
"tags": "",
"deprecated": 0,
"category": "samplecategory"
}
}
}
{
"error": {
"message": "Internal server error. Please fill in bug report with request_id='lp78FL5S1IPMqB2n'"
}
}
I'm certain that the user project_id and the user_id are valid. Is this an error in the API?
Thank you in advance.
Apart from the metrics URI that looks weird (hash instead of numeric ID), I was able to dig in our logs an error that says: "Category is not equal to tag structure".
In your example you have its value set to "samplecategory". "category" property defines what type of object are you creating. If you are creating a report definition it should have value of "reportDefinition".
Last time I worked with GoodData API, metrics had numeric IDs. That seems most likely to be the culprit. Where did you get "/gdc/md/qy48iv4flikdlcwpwioizuip74wt8nb5/obj/63f3cecd2a8d3ce2ec9378381c8f39e3" from, especially the "63f3cecd2a8d3ce2ec9378381c8f39e3" part?