Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more documentation about creation of derived objects (convert item function) #11

Open
MurzNN opened this issue Oct 21, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@MurzNN
Copy link

MurzNN commented Oct 21, 2021

I've caught a problem that convertion of Overpass to GeoJSON result format resets all id of objects to counter from 1, so I can't get original id of object.

I use the example query from https://dev.overpass-api.de/overpass-doc/en/targets/formats.html#json

Here it is: https://overpass-turbo.eu/?lat=51.4775&lon=0.0&zoom=16&Q=%5Bout%3Ajson%5D%3B%0A%28%20way%2851%2E477%2C%2D0%2E001%2C51%2E478%2C0%2E001%29%5Bname%3D%22Blackheath%20Avenue%22%5D%3B%0A%20%20node%28w%29%3B%0A%20%20relation%2851%2E477%2C%2D0%2E001%2C51%2E478%2C0%2E001%29%3B%20%29%3B%0Aconvert%20item%20%3A%3A%3D%3A%3A%2C%3A%3Ageom%3Dgeom%28%29%2C%5Fosm%5Ftype%3Dtype%28%29%3B%0Aout%20geom%3B

In results I see those elements with id, starting from 1:

{
  "type": "item",
  "id": 1,
  "geometry": {
    "type": "Point",
    "coordinates": [ -0.0001831, 51.4770916 ]
  },
  "tags": {
    "_osm_type": "node"
  }
},
{
  "type": "item",
  "id": 2,
  "geometry": {
    "type": "Point",
    "coordinates": [ -0.0000192, 51.4768989 ]
  },
  "tags": {
    "_osm_type": "node"
  }
},

Also I need to keep members with role="admin_centre", that disappears after this conversion.

Maybe I need to add some magic to this query line:

convert item ::=::,::geom=geom(),_osm_type=type();

but link to documentation (from first documentation) shows not so much useful info: https://dev.overpass-api.de/overpass-doc/en/counting/index.html

Can you please add more documentation how the convert item works? Thanks!

@mmd-osm
Copy link

mmd-osm commented Apr 28, 2022

You need to add ::id=id() to the convert statement.

https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example has a few examples, search for „id()“

@drolbr drolbr added the enhancement New feature or request label Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants