Skip to content

Commit

Permalink
Started to incorporate new tile data
Browse files Browse the repository at this point in the history
Need to re-generate Python protobuf code from new .proto file.
  • Loading branch information
migurski committed Mar 19, 2018
1 parent 4370190 commit f90ca29
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
7 changes: 7 additions & 0 deletions sharedstreets/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ def main():
buffer = file.read()
n = 0
while n < len(buffer):
print('=' * 80)
print('bytes', n, end=' ')

msg_len, new_pos = _DecodeVarint32(buffer, n)
n = new_pos
msg_buf = buffer[n:n+msg_len]
n += msg_len

print('to', n, '--', msg_buf[:12].hex(), '...', msg_buf[-12:].hex())

if ProtobufClass is None:
for ProtobufClass in protobuf_classes:
test_object = ProtobufClass()
Expand All @@ -45,6 +50,8 @@ def main():
print('ok:', ProtobufClass)
break

print(' -' * 40)

object = ProtobufClass()
object.ParseFromString(msg_buf)
print(object)
13 changes: 6 additions & 7 deletions sharedstreets/tests/data/geometry.pbf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
�
809235c41285600f26c3bb390a99f344 cf319bbba2a851a17fef70558dbe54ff b21b5e9166f8c77534896247c7143527" c2692e4b4ce5551a08d21bcb018c92a70:@���ґ^�U
����B@C~�+Б^�ǃ-v��B@�%����^����t��B@ɳ˷��^��x��B@�
802f5d102ca9351370a7baa86b0a3ffe 600b91143e1bf922d7fbe016d5eef650 a602006b9eef95dc9ae603832b01f0fa" 55150464fa72ca89eb7283a3cd810bb5* df682aec802c413ee186322d11ced42e0: ��OK=�^�cM�
K�B@qI�J;�^��N�
P�B@�
8072396f545c82abcb34bd5124c4ba6d ba2a07acec76b703e467c44dfdb0b267 52a9d137f2ccb5479ca7c5e899b8c8f7" 1f5ab6204f32b76ebacbaadd659a15480:0`H�@��^��if�K�B@Bz���^�x�'-\�B@�O��^� N3�^�B@
�
80832506185371acf24df519ce271d31 bd188f40bcf79a5f0ea449d517634256 bcf50f7542fa573650bb988664e29a61" d972d167f9874b1367961cbd5c8cba04* 157e6746fc5ed0df77971ca8c7831f270:PV2[�^�+~���B@Q���ʒ^�n����B@���’^��|ޯ�B@�C�Y’^��f
��B@K�����^��6���B@�
80a8a7c120332bfb679f877472c9c18d b538bf59f065f54cf3c6f6113870c0ea dccf37896f270405fe288e9c6ec20422" 4bc556d4b905bb2bf789d77ea257c9f1* 09af6339fc020e47daf0039176308e890: r9���^�~�8h
�B@- ��ؒ^��=� �B@�
82b5776e9fcce1c64a431a14bd59b15d ccc0fe7c9d2a9b1836ffe2d88ceceacb cf1838fe859aceec5f54bad0c35e3731" bad3720e86397a9164ea532c2d209ac70:��j��1�^������B@Q�o!4�^��#01��B@-V�4�^���-���B@㡔5�^���r?��B@���G6�^��A{���B@gh��6�^��~ ���B@��#7�^����:��B@[X�k8�^��O����B@
Expand Down
16 changes: 8 additions & 8 deletions sharedstreets/tests/test_tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ def test_iter_objects_geometry(self):
tile.data_classes['geometry'])
g1, g2, g3 = list(geometries)

self.assertEqual(g1.id, '809235c41285600f26c3bb390a99f344')
self.assertEqual(g1.lonlats[0:2], [-122.2784457, 37.8045933])
self.assertEqual(len(g1.lonlats), 8)
self.assertEqual(g1.id, '80832506185371acf24df519ce271d31')
self.assertEqual(g1.lonlats[0:2], [-122.2951692, 37.8564139])
self.assertEqual(len(g1.lonlats), 10)

self.assertEqual(g2.id, '802f5d102ca9351370a7baa86b0a3ffe')
self.assertEqual(g2.lonlats[0:2], [-122.28499110000001, 37.8226026])
self.assertEqual(g2.id, '80a8a7c120332bfb679f877472c9c18d')
self.assertEqual(g2.lonlats[0:2], [-122.2926467, 37.7971926])
self.assertEqual(len(g2.lonlats), 4)

self.assertEqual(g3.id, '8072396f545c82abcb34bd5124c4ba6d')
self.assertEqual(g3.lonlats[0:2], [-122.25996420000001, 37.853876400000004])
self.assertEqual(len(g3.lonlats), 6)
self.assertEqual(g3.id, '82b5776e9fcce1c64a431a14bd59b15d')
self.assertEqual(g3.lonlats[0:2], [-122.28428740000001, 37.827691900000005])
self.assertEqual(len(g3.lonlats), 16)

def test_iter_objects_reference(self):

Expand Down

0 comments on commit f90ca29

Please sign in to comment.