Flexible Polyline encoding (PBAPI extension)
Project description
FlexPolyline and HERE Polyline
This is a fork of the python implementation of the Flexible Polyline
format.
It has been developed to support the HERE polyline encoding used by
HERE Places (Search) API
for the compressedRoute
requests parameter.
Use the original repo heremaps/flexible-polyline if you only need to encode/decode polylines used in HERE Geocoding & Search API or HERE Routing API.
Install
$ pip install python-flexpolyline-pbapi
Usage
>>> encode(iterable, pbapi=True)
Encodes a list (or iterator) of coordinates to the corresponding HERE polyline string representation.
Coordinate order is (lat, lng[, width])
.
>>> decode(polyline_string, pbapi=True)
Decodes a HERE polyline string into an array of coordinates (lat, lng[, width])
.
Note that width
is expected to be one of DW
, HW
, CW
.
Examples
import flexpolyline_pbapi as fp
example = [
(50.1022829, 8.6982122),
(50.1020076, 8.6956695),
(50.1006313, 8.6914960),
(50.0987800, 8.6875156),
]
print(fp.encode(example, pbapi=True))
Output: oz5xJ67i1B1B7PzIhaxL7Y
.
import flexpolyline_pbapi as fp
print(fp.dict_decode("oz5xJ67i1B.C1B7PzIha.DxL7Y", pbapi=True))
Output:
[
(50.10228, 8.69821, 'CW'),
(50.10201, 8.69567),
(50.10063, 8.6915, 'DW')
]
License
Copyright (C) 2019 HERE Europe B.V.
See the LICENSE file in the root of this project for license details.
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
Built Distribution
Hashes for python-flexpolyline-pbapi-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72b8364ebf938a55c24b26fa3dd9cea802eade6cbb609785b7fc1231e59beb82 |
|
MD5 | 54b03588c28377507518f4a910b3a45c |
|
BLAKE2b-256 | d9a487945fdc51b5731b78f716c5036e7570e82b711a8807fc82c1d5e1fa4dbb |
Hashes for python_flexpolyline_pbapi-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e588f861f0801f93a9166895cbea61aa6f1434c6c40f305aa5d6ad08eebb5a0 |
|
MD5 | 3afcd8749d7873e0e3c653abe80963bd |
|
BLAKE2b-256 | dfce4bbff02766d0a3c67f15cbc41be574685c8c864337665b0a388785476092 |