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

Hello again,

I would like to know how can i use the overpass api of pyhton to store information into my Postgresql database (i have a PostGIS extencion) . My idea was to get the "id" of the nodes and then creating an "id" camp on the database gather the information of the tags in question.

Thank you again for all the help,

Francisco Costa

asked 03 Nov '15, 10:09

FrancisCosta's gravatar image

accept rate: 0%

Hi, You can use the overpass API to get data from OSM and then OGR to write it to PostgreSQL. You can do it on the command line or within Python. The intermediate format can be the native OSM XML format, or you can change to JSON.

Example on command line:

wget '["highway"="residential"]["name"](41.8942593,12.4812841,41.9030756,12.4945021);out;' -O rome.osm 
osm2pgsql -H localhost -s -U geobox -d geotuga -c rome.osm
permanent link

answered 04 Nov '15, 11:10

Jorge%20Gustavo%20Rocha's gravatar image

Jorge Gustav...
accept rate: 0%

Maybe you can try QGIS for this task?

QGIS has a plugin called QuickOSM where you can query for OSM data via overpassAPI.

And QGIS has an interface to Postgresql databases, or not? But I have no clue whether that interface is a oneway connection just to load data from database in QGIS.

Have NOT tried that on my own.

permanent link

answered 03 Nov '15, 16:35

stephan75's gravatar image

accept rate: 6%

I regularly pull GEOJSON from Overpass into QGIS & push to PostGIS: but this is a distinctly non-automated approach.

(04 Nov '15, 11:50) SK53 ♦

@SK53: just to clarify your statement: I guess you mean "pull GeoJSON from overpass turbo"? The difference is quite important, as Overpass API doesn't provide GeoJSON out of the box. It provides some custom JSON format only, which doesn't really qualify as GeoJSON.

(04 Nov '15, 12:03) mmd

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 03 Nov '15, 10:09

question was seen: 5,533 times

last updated: 04 Nov '15, 12:16

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