A tool to convert strings between HERE Flexible Polyline format and the (now legacy) format used in HERE Places API
Project description
A tool to encode/decode HERE legacy polyline strings and convert them from/into HERE Flexible Polyline format.
Note that the HERE Places (Search) API is in maintenance: Developers need to adapt their applications to the newer HERE Geocoding & Search API to benefit from the features developed after 2018.
Install
pip install here-polyline-converter
Usage
>>> convert_legacy_to_flex(legacy_polyline_string)
Transforms a HERE legacy polyline string into a flexible polyline string. The legacy Polyline third dimension (segments width changes) is ignored.
>>> encode_legacy(iterable)
Encodes a list of coordinates to the corresponding HERE legacy polyline string representation.
Expected coordinates order: (lat, lng[, width])
. Note that width
is expected to be one of DW
, HW
, CW
.
>>> decode_legacy(legacy_polyline_string)
Decodes a HERE legacy polyline string into an array of coordinates (lat, lng[, width])
.
Note that width
is expected to be one of DW
, HW
, CW
.
Examples
>>> import here_search.polyline_converter as pc
>>> legacy_polyline = "oz5xJ67i1B1B7PzIhaxL7Y"
>>> flexible_polyline = pc.convert_legacy_to_flex(legacy_polyline)
>>> flexible_polyline
'BFoz5xJ67i1B1B7PzIhaxL7Y'
>>> points = [(50.1022829, 8.6982122), (50.1020076, 8.6956695), (50.1006313, 8.6914960), (50.0987800, 8.6875156)]
>>> pc.encode_legacy(points)
'oz5xJ67i1B1B7PzIhaxL7Y'
>>> legacy_polyline = "oz5xJ67i1B.C1B7PzIha.DxL7Y"
>>> pc.decode_legacy(legacy_polyline)
[(50.10228, 8.69821, 'CW'), (50.10201, 8.69567), (50.10063, 8.6915, 'DW'), (50.09878, 8.68752)]
License
Copyright (C) 2023 HERE Europe B.V.
See the LICENSE file in the root of this project for license details.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file here-polyline-converter-0.2.0.tar.gz
.
File metadata
- Download URL: here-polyline-converter-0.2.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00ec7dc64a6fc0831aced4873080fa8d81cf0e0ad0a9df3d2fccd2fd39aec9b9 |
|
MD5 | 64bd8f861e86c19fabac2fb903d4296f |
|
BLAKE2b-256 | b26a47d3023d39b4f5e4b6214cd534b543da5e39e1e83135a4b95d02916e9387 |
File details
Details for the file here_polyline_converter-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: here_polyline_converter-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76e69e2acbf0ca73993a5e6dc1205239d714887234bf3b71ced69bcbe41b8f50 |
|
MD5 | 59d8d95d39453f062a94eedfcfe0f97c |
|
BLAKE2b-256 | 6ea3aefa03c5f8d40c34763521acff376a4c9575db44c78c06184087ac26d19a |