NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

2
1

Hi all!

I've tried to play with Overpass from command line because I've to do a query quite "expensive" that Overpass Turbo can't to do

My issue is about to download all the addresses in Italy

Here you are my query (it comes from Overpass Turbo ...)

<osm-script output="json"> <union into=""> <query into="" type="node"> <has-kv k="addr:housenumber" modv="" v=""/> <bbox-query e="20.01708984375" into="" n="47.15984001304432" s="36.27970720524017" w="5.9765625"/> </query> </union> <print e="" from="" geometry="skeleton" limit="" mode="body" n="" order="id" s="" w=""/> <recurse from="" into="" type="down"/> <print e="" from="_" geometry="skeleton" limit="" mode="skeleton" n="" order="quadtile" s="" w=""/> </osm-script>

I've saved it in a file "CiviciItalia.txt", and then I've used the following command

wget --post-file=CiviciItalia.txt http://overpass-api.de/api/interpreter --output-document=CiviciItalia.json

All works fine and I've obtained a .json file but ...... how may I visualize it on some GIS desktop tools (es. QGIS)?

Any suggestion is appreciated

Cesare

asked 13 Jan '15, 09:10

cesaregerbino's gravatar image

cesaregerbino
41113
accept rate: 0%


Try QuickOSM (a QGIS plugin). It can run Overpass queries, does all the conversion 'under the hood' and presents the result as new layer in QGIS. You can also save that result as shape file, etc. And it should also run on Windows.

BTW: I wonder why you didn't specify a timeout value in your query. Quite likely you're getting incomplete results after hitting the timeout.

permanent link

answered 13 Jan '15, 11:52

mmd's gravatar image

mmd
5.7k15388
accept rate: 37%

edited 13 Jan '15, 11:58

1

I've also tried to use QuickOSM using QGIS 2.6.1 but can't obtain the result, something goes wrong.

About timeout .... By default Overpass Turbo put timeout:25 but my query is much longer ..... So I've decided to drop timeout ... I'm a newbie about overpass: have I to specify in any case a timeout to avoid incomplete result?

(13 Jan '15, 12:24) cesaregerbino

Regarding the timeout: Overpass API immediately starts sending some data rather than buffering the whole result. If you happen to see a respective error message at the end of your json file, your timeout was too low. (see timeout for more details).

In any case, I would recommend to set at least a timeout of 300 seconds. The query took about 2-3 minutes when I executed it.

(13 Jan '15, 20:45) mmd

Your query result gives QGIS a really hard time. Crunching numbers for 20 minutes now, still not finished, GeoJSON temporary file is now at about 3.5GB, still counting...

Maybe you need to think about some other approach, like feeding the result into a PostGIS database instead.

(13 Jan '15, 21:53) mmd

I have done something similar to that for my hackerspace map (ignore the old link for 'how it's made'). I used osmtogeojson, a command line programme that converts the JSON from Overpass into a GeoJSON file, that you can then display with Leaflet, like I do with that map. QGis should be able to open GeoJSON files as well. osmtogeojson is the programme that overpass turbo uses to convert to geojson to display on the map.

permanent link

answered 13 Jan '15, 09:48

rorym's gravatar image

rorym
5.4k1449100
accept rate: 11%

I've seen ... Unfortunately I'm on Windows 7 now ..... I'll try to do using a Linux VM ....

(13 Jan '15, 09:59) cesaregerbino

It's a javascript programme, and installable with node package manager (npm). Maybe it might work on windows? Javascript /is/ cross platform (ish)...

(13 Jan '15, 10:03) rorym

I'll try ....

(13 Jan '15, 10:05) cesaregerbino

geojson.io can also open and display the geojson files from the osmtogeojson script (I presume). To make it all happen from the command line, you should be able to pipe the output of osmtogeojson into geoq map after installing geoq from https://github.com/worace/geoq

(11 Nov '18, 03:22) b-jazz

Another option is to use the CSV output format, with the ::lat and ::lon columns, which gives you the lat/lon of the 'centre' of a polygon or the location of the point. You can add extra tags as columns. This will only give you points, not polygons.

QGis can support Deliminted Text (like CSV), so you should be able to open the file in it.

permanent link

answered 14 Jan '15, 11:46

rorym's gravatar image

rorym
5.4k1449100
accept rate: 11%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×483
×228
×85

question asked: 13 Jan '15, 09:10

question was seen: 9,806 times

last updated: 11 Nov '18, 03:22

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum