[imposm-parser] 12/29: Imported Upstream version 1.0.3

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Fri Mar 13 19:11:20 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository imposm-parser.

commit d1fd38eca0e4a3892f19ca867fddf7812423ec2b
Author: David Paleino <dapal at debian.org>
Date:   Wed Sep 7 10:10:15 2011 +0200

    Imported Upstream version 1.0.3
---
 CHANGES                         |  6 ++++++
 PKG-INFO                        |  8 +++++++-
 imposm.parser.egg-info/PKG-INFO |  8 +++++++-
 imposm/parser/example.py        | 25 +++++++++++++++----------
 imposm/parser/pbf/parser.py     | 13 ++++++++-----
 setup.py                        |  2 +-
 6 files changed, 44 insertions(+), 18 deletions(-)

diff --git a/CHANGES b/CHANGES
index eca775a..579d1e5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,12 @@
 Changelog
 ---------
 
+1.0.3 2011-07-21
+~~~~~~~~~~~~~~~~
+
+- support for uncompressed PBF
+- bug fix for PBF without dense nodes
+
 1.0.2 2011-03-10
 ~~~~~~~~~~~~~~~~
 
diff --git a/PKG-INFO b/PKG-INFO
index cf13c99..e89360c 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: imposm.parser
-Version: 1.0.2
+Version: 1.0.3
 Summary: Fast and easy OpenStreetMap XML/PBF parser.
 Home-page: http://dev.omniscale.net/imposm.parser/
 Author: Oliver Tonnhofer
@@ -52,6 +52,12 @@ Description: .. # -*- restructuredtext -*-
         Changelog
         ---------
         
+        1.0.3 2011-07-21
+        ~~~~~~~~~~~~~~~~
+        
+        - support for uncompressed PBF
+        - bug fix for PBF without dense nodes
+        
         1.0.2 2011-03-10
         ~~~~~~~~~~~~~~~~
         
diff --git a/imposm.parser.egg-info/PKG-INFO b/imposm.parser.egg-info/PKG-INFO
index cf13c99..e89360c 100644
--- a/imposm.parser.egg-info/PKG-INFO
+++ b/imposm.parser.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: imposm.parser
-Version: 1.0.2
+Version: 1.0.3
 Summary: Fast and easy OpenStreetMap XML/PBF parser.
 Home-page: http://dev.omniscale.net/imposm.parser/
 Author: Oliver Tonnhofer
@@ -52,6 +52,12 @@ Description: .. # -*- restructuredtext -*-
         Changelog
         ---------
         
+        1.0.3 2011-07-21
+        ~~~~~~~~~~~~~~~~
+        
+        - support for uncompressed PBF
+        - bug fix for PBF without dense nodes
+        
         1.0.2 2011-03-10
         ~~~~~~~~~~~~~~~~
         
diff --git a/imposm/parser/example.py b/imposm/parser/example.py
index e1b7b02..59ae9f0 100644
--- a/imposm/parser/example.py
+++ b/imposm/parser/example.py
@@ -15,26 +15,31 @@
 import sys
 import multiprocessing
 from imposm.parser import OSMParser
-from collections import defaultdict
-
-def ways_tag_filter(tags):
-    for key in tags.keys():
-        if key != 'highway':
-          del tags[key]
 
 if __name__ == '__main__':
     
     class Counter(object):
         def __init__(self):
+            self.coords_counter = 0
+            self.nodes_counter = 0
             self.ways_counter = 0
             self.relations_counter = 0
+
+        def incr_coords(self, coords):
+            self.coords_counter += len(coords)
+        def incr_nodes(self, nodes):
+            self.nodes_counter += len(nodes)
         def incr_ways(self, ways):
-            self.ways_counter += len([id for id,tags,ref in ways if 'highway' in tags])
+            self.ways_counter += len(ways)
         def incr_relations(self, relations):
             self.relations_counter += len(relations)
             
     counter = Counter()
-    p = OSMParser(ways_callback=counter.incr_ways, relations_callback=counter.incr_relations,
-        ways_tag_filter=ways_tag_filter)
+    
+    p = OSMParser(
+        nodes_callback=counter.incr_nodes,
+        coords_callback=counter.incr_coords,
+        ways_callback=counter.incr_ways,
+        relations_callback=counter.incr_relations)
     p.parse(sys.argv[1])
-    print counter.ways_counter, counter.relations_counter
\ No newline at end of file
+    print counter.coords_counter, counter.nodes_counter, counter.ways_counter, counter.relations_counter
\ No newline at end of file
diff --git a/imposm/parser/pbf/parser.py b/imposm/parser/pbf/parser.py
index 2ddbfe6..b1adf1f 100644
--- a/imposm/parser/pbf/parser.py
+++ b/imposm/parser/pbf/parser.py
@@ -153,7 +153,7 @@ class PrimitiveBlockParser(object):
     """
     def __init__(self, filename, blob_pos, blob_size):
         self.pos = filename, blob_pos, blob_size
-        data = read_blob_zlib_data(filename, blob_pos, blob_size)
+        data = read_blob_data(filename, blob_pos, blob_size)
         self.primitive_block = OSMPBF.PrimitiveBlock()
         self.primitive_block.ParseFromString(data)
         self.primitivegroup = self.primitive_block.primitivegroup
@@ -269,7 +269,7 @@ class PrimitiveBlockParser(object):
                     
 class PBFHeader(object):
     def __init__(self, filename, blob_pos, blob_size):
-        data = read_blob_zlib_data(filename, blob_pos, blob_size)
+        data = read_blob_data(filename, blob_pos, blob_size)
         self.header_block = OSMPBF.HeaderBlock()
         self.header_block.ParseFromString(data)
         
@@ -277,9 +277,9 @@ class PBFHeader(object):
         return set(self.header_block.required_features)
 
 
-def read_blob_zlib_data(filename, blob_pos, blob_size):
+def read_blob_data(filename, blob_pos, blob_size):
     """
-    Returns the unzipped blob data from.
+    Returns the (unzipped) blob data from filename and position.
     """
     with open(filename, 'rb') as f:
         f.seek(blob_pos)
@@ -287,6 +287,9 @@ def read_blob_zlib_data(filename, blob_pos, blob_size):
         
     blob = OSMPBF.Blob()
     blob.ParseFromString(blob_data)
+    raw_data = blob.raw
+    if raw_data:
+        return raw_data
     return zlib.decompress(blob.zlib_data)
 
 import time
@@ -309,7 +312,7 @@ class PBFFile(object):
         self.check_features()
     
     def check_features(self):
-        missing_features = SUPPORTED_FEATURES.difference(self.header.required_features())
+        missing_features = self.header.required_features().difference(SUPPORTED_FEATURES)
         if missing_features:
             raise NotImplementedError(
                 '%s requires features not implemented by this parser: %s' %
diff --git a/setup.py b/setup.py
index e800bda..9160157 100644
--- a/setup.py
+++ b/setup.py
@@ -36,7 +36,7 @@ if platform.python_version_tuple() < ('2', '6'):
 
 setup(
     name='imposm.parser',
-    version="1.0.2",
+    version="1.0.3",
     description='Fast and easy OpenStreetMap XML/PBF parser.',
     long_description=open('README').read() + open('CHANGES').read(),
     author='Oliver Tonnhofer',

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/imposm-parser.git



More information about the Pkg-grass-devel mailing list