Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. tilemaker input.pbf --output=tiles/
  2.  
  3. mkdir py
  4. touch py/__init__.py
  5. protoc --proto_path=include --python_out=./py ./include/osmformat.proto
  6. protoc --proto_path=include --python_out=./py ./include/vector_tile.proto
  7.  
  8. import sys
  9. import py.vector_tile_pb2
  10.  
  11. with open(sys.argv[1]) as fp:
  12. pbf_file_contents = fp.read()
  13.  
  14. tile = py.vector_tile_pb2.Tile()
  15. tile.ParseFromString(pbf_file_contents)
  16.  
  17. $ python pyread.py ./tiles/13/3932/2588.pbf
  18. Traceback (most recent call last):
  19. File "pyread.py", line 8, in <module>
  20. tile.ParseFromString(pbf_file_contents)
  21. File "/home/rory/.local/lib/python2.7/site-packages/google/protobuf/message.py", line 186, in ParseFromString
  22. self.MergeFromString(serialized)
  23. File "/home/rory/.local/lib/python2.7/site-packages/google/protobuf/internal/python_message.py", line 841, in MergeFromString
  24. if self._InternalParse(serialized, 0, length) != length:
  25. File "/home/rory/.local/lib/python2.7/site-packages/google/protobuf/internal/python_message.py", line 866, in InternalParse
  26. new_pos = local_SkipField(buffer, new_pos, end, tag_bytes)
  27. File "/home/rory/.local/lib/python2.7/site-packages/google/protobuf/internal/decoder.py", line 827, in SkipField
  28. return WIRETYPE_TO_SKIPPER[wire_type](buffer, pos, end)
  29. File "/home/rory/.local/lib/python2.7/site-packages/google/protobuf/internal/decoder.py", line 797, in _RaiseInvalidWireType
  30. raise _DecodeError('Tag had invalid wire type.')
  31. google.protobuf.message.DecodeError: Tag had invalid wire type.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement