here-polyline-converter


Namehere-polyline-converter JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://here.com
SummaryA tool to convert strings between HERE Flexible Polyline format and the (now legacy) format used in HERE Places API
upload_time2023-04-26 08:50:41
maintainer
docs_urlNone
authorHERE Europe B.V.
requires_python>=3.7
licenseThe MIT License
keywords here search polyline gs7
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![workflow][b]
[![codecov][c1]][c2]

A tool to encode/decode [HERE legacy polyline][4] strings and convert them from/into HERE [Flexible Polyline][1] format.

Note that the [HERE Places (Search) API][2] is in maintenance: Developers need to adapt their applications to the newer
[HERE Geocoding & Search API][3] to benefit from the features developed after 2018.


## Install

```shell
pip install here-polyline-converter
```

## Usage


```python
>>> 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.

```python
>>> 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`.


```python
>>> 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

```python
>>> 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](./LICENSE) file in the root of this project for license details.

[1]: https://github.com/heremaps/flexible-polyline
[2]: https://developer.here.com/documentation/places/dev_guide/topics/guide.html
[3]: https://developer.here.com/documentation/geocoding-search-api/dev_guide/index.html
[4]: https://developer.here.com/documentation/places/dev_guide/topics/location-contexts.html#location-contexts__here-polyline-encoding
[b]: https://github.com/heremaps/here-polyline-converter/actions/workflows/test.yml/badge.svg
[c1]: https://codecov.io/gh/heremaps/here-polyline-converter/branch/main/graph/badge.svg?token=9LPI9T7BMN
[c2]: https://codecov.io/gh/heremaps/here-polyline-converter

            

Raw data

            {
    "_id": null,
    "home_page": "https://here.com",
    "name": "here-polyline-converter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "HERE,Search,Polyline,GS7",
    "author": "HERE Europe B.V.",
    "author_email": "emmanuel.decitre@here.com",
    "download_url": "https://files.pythonhosted.org/packages/a1/2f/c250e1224136198e5ec2bfbb152f99ca5c3f3a6262af16a882ba31b9490c/here-polyline-converter-0.2.1.tar.gz",
    "platform": "any",
    "description": "![workflow][b]\n[![codecov][c1]][c2]\n\nA tool to encode/decode [HERE legacy polyline][4] strings and convert them from/into HERE [Flexible Polyline][1] format.\n\nNote that the [HERE Places (Search) API][2] is in maintenance: Developers need to adapt their applications to the newer\n[HERE Geocoding & Search API][3] to benefit from the features developed after 2018.\n\n\n## Install\n\n```shell\npip install here-polyline-converter\n```\n\n## Usage\n\n\n```python\n>>> convert_legacy_to_flex(legacy_polyline_string)\n```\n\nTransforms a HERE legacy polyline string into a flexible polyline string. The legacy Polyline third dimension (segments width changes) is ignored.\n\n```python\n>>> encode_legacy(iterable)\n```\n\nEncodes a list of coordinates to the corresponding HERE legacy polyline string representation. \nExpected coordinates order: `(lat, lng[, width])`. Note that `width` is expected to be one of `DW`, `HW`, `CW`.\n\n\n```python\n>>> decode_legacy(legacy_polyline_string)\n```\n\nDecodes a HERE legacy polyline string into an array of coordinates `(lat, lng[, width])`.\n\n\nNote that `width` is expected to be one of `DW`, `HW`, `CW`.\n\n#### Examples\n\n```python\n>>> import here_search.polyline_converter as pc\n>>> legacy_polyline = \"oz5xJ67i1B1B7PzIhaxL7Y\"\n>>> flexible_polyline = pc.convert_legacy_to_flex(legacy_polyline)\n>>> flexible_polyline\n'BFoz5xJ67i1B1B7PzIhaxL7Y'\n\n>>> points = [(50.1022829, 8.6982122), (50.1020076, 8.6956695), (50.1006313, 8.6914960), (50.0987800, 8.6875156)]\n>>> pc.encode_legacy(points)\n'oz5xJ67i1B1B7PzIhaxL7Y'\n\n>>> legacy_polyline = \"oz5xJ67i1B.C1B7PzIha.DxL7Y\"\n>>> pc.decode_legacy(legacy_polyline)\n[(50.10228, 8.69821, 'CW'), (50.10201, 8.69567), (50.10063, 8.6915, 'DW'), (50.09878, 8.68752)]\n```\n\n## License\n\nCopyright (C) 2023 HERE Europe B.V.\n\nSee the [LICENSE](./LICENSE) file in the root of this project for license details.\n\n[1]: https://github.com/heremaps/flexible-polyline\n[2]: https://developer.here.com/documentation/places/dev_guide/topics/guide.html\n[3]: https://developer.here.com/documentation/geocoding-search-api/dev_guide/index.html\n[4]: https://developer.here.com/documentation/places/dev_guide/topics/location-contexts.html#location-contexts__here-polyline-encoding\n[b]: https://github.com/heremaps/here-polyline-converter/actions/workflows/test.yml/badge.svg\n[c1]: https://codecov.io/gh/heremaps/here-polyline-converter/branch/main/graph/badge.svg?token=9LPI9T7BMN\n[c2]: https://codecov.io/gh/heremaps/here-polyline-converter\n",
    "bugtrack_url": null,
    "license": "The MIT License",
    "summary": "A tool to convert strings between HERE Flexible Polyline format and the (now legacy) format used in HERE Places API",
    "version": "0.2.1",
    "split_keywords": [
        "here",
        "search",
        "polyline",
        "gs7"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4a62336c5dcae3df73e70acc9cd415b2de3c0ae6b91b4184f338699e141b9011",
                "md5": "344b42c8f104b79b2f5ebe156152902d",
                "sha256": "ecdb161bfd66a97c98f53b774cd6c3cf87e2d96e24dc47a32a40802a7de15f78"
            },
            "downloads": -1,
            "filename": "here_polyline_converter-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "344b42c8f104b79b2f5ebe156152902d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 6171,
            "upload_time": "2023-04-26T08:50:40",
            "upload_time_iso_8601": "2023-04-26T08:50:40.262633Z",
            "url": "https://files.pythonhosted.org/packages/4a/62/336c5dcae3df73e70acc9cd415b2de3c0ae6b91b4184f338699e141b9011/here_polyline_converter-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a12fc250e1224136198e5ec2bfbb152f99ca5c3f3a6262af16a882ba31b9490c",
                "md5": "d976a4644c46c8a051b5cb6f23ce7f72",
                "sha256": "cb45f97165d07cdb407132860ab9894b6cf8b43c249e59ebbc8751b734c87019"
            },
            "downloads": -1,
            "filename": "here-polyline-converter-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "d976a4644c46c8a051b5cb6f23ce7f72",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 6578,
            "upload_time": "2023-04-26T08:50:41",
            "upload_time_iso_8601": "2023-04-26T08:50:41.300478Z",
            "url": "https://files.pythonhosted.org/packages/a1/2f/c250e1224136198e5ec2bfbb152f99ca5c3f3a6262af16a882ba31b9490c/here-polyline-converter-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-26 08:50:41",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "here-polyline-converter"
}
        
Elapsed time: 0.05812s