Skip to main content

Fast and easy OpenStreetMap XML/PBF parser.

Project description

imposm.parser is a Python library that parses OpenStreetMap data in XML and PBF format.

It has a simple API and it is fast and easy to use. It also works across multiple CPU/cores for extra speed.

It is developed and supported by Omniscale and released under the Apache Software License 2.0.

Example

Here is an example that parses an OSM file and counts all ways that are tagged as a highway.

from imposm.parser import OSMParser

# simple class that handles the parsed OSM data.
class HighwayCounter(object):
    highways = 0

    def ways(self, ways):
        # callback method for ways
        for osmid, tags, refs in ways:
            if 'highway' in tags:
              self.highways += 1

# instantiate counter and parser and start parsing
counter = HighwayCounter()
p = OSMParser(concurrency=4, ways_callback=counter.ways)
p.parse('germany.osm.pbf')

# done
print counter.highways

Source and issue tracker

Source code and issue tracker are available at https://bitbucket.org/olt/imposm.parser/src.

Changelog

1.0.3 2011-07-21

  • support for uncompressed PBF

  • bug fix for PBF without dense nodes

1.0.2 2011-03-10

  • improved regexp based XML coord parser

  • prevent mmap overflow in XMLChunker without coord_callback

  • successfully parsed whole planet.osm

1.0.0 2011-02-22

  • first release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imposm.parser-1.0.3.tar.gz (31.8 kB view details)

Uploaded Source

File details

Details for the file imposm.parser-1.0.3.tar.gz.

File metadata

  • Download URL: imposm.parser-1.0.3.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for imposm.parser-1.0.3.tar.gz
Algorithm Hash digest
SHA256 741de5bd5049e693645846b12e84eb9fd10faa83533e3e1ae341d72f811d3b6c
MD5 35f51614da69c78884cdca4a225755e9
BLAKE2b-256 1eaa20c79986749e15bdd6709e54db3945d3e20e135657fec4787e23a77d2c32

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page