heremaps / flexible-polyline

Flexible Polyline encoding: a lossy compressed representation of a list of coordinate pairs or triples
MIT License
91 stars 77 forks source link

Python: dict_decode throws error when 3rd dimension = 'absent','reserved1','reserved2' #62

Closed RenoFilla closed 4 months ago

RenoFilla commented 1 year ago

None of the following works running in dict_decode:

'BGgwjuyDg8wzcgkh9Bgkh9Bgkh9Bgkh9B' (absent) 'BmGgwjuyDg8wzc8Bgkh9Bgkh9BTgkh9Bgkh9BgF' (reserved1) 'B2GgwjuyDg8wzc8Bgkh9Bgkh9BTgkh9Bgkh9BgF' (reserved2)


KeyError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_27848\2616460968.py in ----> 1 fp.dict_decode(p)

C:\Tools\Programming\Anaconda3\lib\site-packages\flexpolyline__init__.py in dict_decode(encoded) 42 """Return an list of coordinates dicts. The dict contains always the keys 'lat', 'lng' and 43 depending on the polyline can contain a third key ('elv', 'lvl' or 'alt').""" ---> 44 return list(iter_dict_decode(encoded))

C:\Tools\Programming\Anaconda3\lib\site-packages\flexpolyline__init__.py in iter_dict_decode(encoded) 30 """Return an iterator over coordinates dicts. The dict contains always the keys 'lat', 'lng' and 31 depending on the polyline can contain a third key ('elv', 'lvl', 'alt', ...).""" ---> 32 third_dim_key = THIRD_DIM_MAP[get_third_dimension(encoded)] 33 for row in iter_decode(encoded): 34 yield {

KeyError: 0