0

I am working with OSM through the Overpass API and/or the QuikcOSM plugin in QGIS. I am wondering if it is possible to select the tags to be downloaded as csv or GeoJSON or KML data.

To make an example, this query will retrieve all the features labelled as 'hospital':

    [out:json][timeout:25];
// gather results
nwr["building"="hospital"]({{bbox}});
// print results
out geom;

but then I want to export only some given tags (let's say "full_id" and "name"). Note that I am not asking to filter the features by tag; the query should include all the existent features, it should only limit the number of tags. This can be very useful in case of large datsets that end in a huge number of attributes when managed in GIS.

There is a similar question here, but is focused only on CSV and I tried to add other tags in addition to 'name' and it did not work.

4
  • Based on the other question with CSV examples you've mentioned, can you maybe post what you have tried that didn't work for you? I'm still not clear on what exactly you're expecting as output.
    – mmd
    Commented May 5 at 10:10
  • @mmd, using the example i provided, if you launch the query on large areas that usually include different nations, you'll get a massive number of attributes that are not useful. For instance, you would usually get "name", "name:en", "name:de" etc, while "name" would be enough. Filter these data after the download can be challenging because attributes can be some hundreds. I don't know if I made it clearer or not.
    – HyPhens
    Commented May 5 at 11:40
  • The example I've posted in gis.stackexchange.com/a/246328/37540 includes a header [out:csv ...] where you can define the exact fields and sequence you want to get in the CSV result. Did you try this out already? In your example above, [out:json] returns JSON output, and is expected to contain every single field available in the source data. I'm not entirely clear what format you're expecting in the end. Is it JSON, CSV, or something else maybe?
    – mmd
    Commented May 5 at 15:18
  • @mmd, yes it is certainly JSON; I think I had a look at your answer, but let me crosscheck as soon as I can.
    – HyPhens
    Commented May 5 at 18:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.