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

Michael Reichert osm-ml at michreichert.de
Fri Dec 21 14:01:56 UTC 2018


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)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20181221/94368652/attachment.sig>


More information about the dev mailing list