[OSM-dev] OSM->PostGIS Python tool?

Pierre Béland pierzenh at yahoo.fr
Fri Dec 21 14:44:53 UTC 2018


For Building quality analysis, I extract data from Overpass-API and I import into PostgreSQL/PostGIS schemas,  I use a solution based on osmosis pgsnapshot_schema_0.6. This solution similar to OSM2Pgsql is well documented and facilitates a lot importing OSM database extracs into PostGIS.

Telenav uses a similar approach that they documented on Github
See https://github.com/TelenavMapping/verifying_our_edits
The Osmosis instruction to import in  PostgreSQL, do not let specify a particular database schema. Like in the main.sh script, the solution is to first load data in the public schema. Once loaded, it is moved it to a particular schema. 

 
Pierre 
 

    Le vendredi 21 décembre 2018 09 h 08 min 41 s HNE, Michael Reichert <osm-ml at michreichert.de> a écrit :  
 
 Hi Spencer,

Am 21/12/2018 um 05.54 schrieb Spencer Gardner:
> I'm researching options for a Python-based tool that uses OSM data. From
> what I can gather there's no native Python library for OSM imports to a
> PostGIS database. (Yes, imposm is developed in Python but there's no
> documentation I can find on how to use it as a Python library--it appears
> to be intended as a command line tool). This seems odd to me since there's
> such a large community of OSM users. I feel like I'm missing something. Are
> there other viable Python libraries I'm not aware of? (Viable = large-ish
> user base and history of bugfixing.) Is there documentation for using
> imposm within Python that I've overlooked?

There are currently two serious import programmes for OSM data into
PostGIS databases – Osm2pgsql and Imposm 3. The first one is written in
C++ (formerly C), the second one in Go.

I am not aware of any well-known Python library for an import. Given the
typical use cases and the speed of existing solutions, it is unlikely
that there is any. There are Python bindings of the C++ library
Libosmium. The bindings are called Pyosmium. Libosmium is the fastest
library to deal with OSM data.

Why do you need a library for the import? Which use cases are not
covered by Osm2pgsql or Imposm 3?

Please keep in mind that OSM data is large (our planet is about 40 GB in
.osm.pbf format). Using a interpreted language is a waste of time and
energy for most purposes.

> Bonus points for:
> - Windows compatibility
> - No external (i.e. non-Python) libraries needed

Osm2pgsql runs under Windows.

Best regards

Michael

-- 
Per E-Mail kommuniziere ich bevorzugt GPG-verschlüsselt. (Mailinglisten
ausgenommen)
I prefer GPG encryption of emails. (does not apply on mailing lists)
_______________________________________________
dev mailing list
dev at openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20181221/ecd1d786/attachment.html>


More information about the dev mailing list