# osm-shortlink
[![PyPI - Python Version](https://shields.monicz.dev/pypi/pyversions/osm-shortlink)](https://pypi.org/project/osm-shortlink)
[![Liberapay Patrons](https://shields.monicz.dev/liberapay/patrons/Zaczero?logo=liberapay&label=Patrons)](https://liberapay.com/Zaczero/)
[![GitHub Sponsors](https://shields.monicz.dev/github/sponsors/Zaczero?logo=github&label=Sponsors&color=%23db61a2)](https://github.com/sponsors/Zaczero)
Fast and correct OpenStreetMap shortlink encoder and decoder implementation in Rust with Python bindings. Shortlinks allow you to represent a location on the map with a short code.
## Installation
The recommended installation method is through the PyPI package manager. The project is implemented in Rust, offering excellent performance characteristics. Several pre-built binary wheels are available for Linux, macOS, and Windows, with support for both x64 and ARM architectures.
```sh
pip install osm-shortlink
```
## Basic usage
```py
from osm_shortlink import shortlink_encode
shortlink_encode(0.054, 51.510, 9) # -> '0EEQhq--'
shortlink_encode(19.579, 51.876, 19) # -> '0OP4tR~rx'
shortlink_encode(0, 0, 23) # ValueError: Invalid zoom: must be between 0 and 22, got 23
from osm_shortlink import shortlink_decode
shortlink_decode('0EEQhq--') # -> (0.054, 51.510, 9)
shortlink_decode('0OP4tR~rx') # -> (19.579, 51.876, 19)
shortlink_decode('X') # ValueError: Invalid shortlink: too short
```
## Format specification
<https://wiki.openstreetmap.org/wiki/Shortlink>
Raw data
{
"_id": null,
"home_page": null,
"name": "osm-shortlink",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "decoder, encoder, openstreetmap, osm, shortlink, url",
"author": null,
"author_email": "Kamil Monicz <kamil@monicz.dev>",
"download_url": "https://files.pythonhosted.org/packages/0e/e4/89d19290099449b978d4fc15ac08950fad0ff72c641230d4e4f9bb588c5e/osm_shortlink-1.1.0.tar.gz",
"platform": null,
"description": "# osm-shortlink\n\n[![PyPI - Python Version](https://shields.monicz.dev/pypi/pyversions/osm-shortlink)](https://pypi.org/project/osm-shortlink)\n[![Liberapay Patrons](https://shields.monicz.dev/liberapay/patrons/Zaczero?logo=liberapay&label=Patrons)](https://liberapay.com/Zaczero/)\n[![GitHub Sponsors](https://shields.monicz.dev/github/sponsors/Zaczero?logo=github&label=Sponsors&color=%23db61a2)](https://github.com/sponsors/Zaczero)\n\nFast and correct OpenStreetMap shortlink encoder and decoder implementation in Rust with Python bindings. Shortlinks allow you to represent a location on the map with a short code.\n\n## Installation\n\nThe recommended installation method is through the PyPI package manager. The project is implemented in Rust, offering excellent performance characteristics. Several pre-built binary wheels are available for Linux, macOS, and Windows, with support for both x64 and ARM architectures.\n\n```sh\npip install osm-shortlink\n```\n\n## Basic usage\n\n```py\nfrom osm_shortlink import shortlink_encode\nshortlink_encode(0.054, 51.510, 9) # -> '0EEQhq--'\nshortlink_encode(19.579, 51.876, 19) # -> '0OP4tR~rx'\nshortlink_encode(0, 0, 23) # ValueError: Invalid zoom: must be between 0 and 22, got 23\n\nfrom osm_shortlink import shortlink_decode\nshortlink_decode('0EEQhq--') # -> (0.054, 51.510, 9)\nshortlink_decode('0OP4tR~rx') # -> (19.579, 51.876, 19)\nshortlink_decode('X') # ValueError: Invalid shortlink: too short\n```\n\n## Format specification\n\n<https://wiki.openstreetmap.org/wiki/Shortlink>\n\n",
"bugtrack_url": null,
"license": null,
"summary": "OpenStreetMap shortlink encoder and decoder",
"version": "1.1.0",
"project_urls": {
"Issues": "https://github.com/Zaczero/osm-shortlink/issues",
"Repository": "https://github.com/Zaczero/osm-shortlink"
},
"split_keywords": [
"decoder",
" encoder",
" openstreetmap",
" osm",
" shortlink",
" url"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0d1684ff9e4d8cf3f3cbf2e3a9d3a47129f6930f0c271685d9381c52f47ab85f",
"md5": "ce991a944286bfd84a539fd5f394ff98",
"sha256": "7e91460c41f98ea24a55b5978125e237c02b409ac7ef4f415e7957cf4e6a69c2"
},
"downloads": -1,
"filename": "osm_shortlink-1.1.0-cp39-abi3-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "ce991a944286bfd84a539fd5f394ff98",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 218860,
"upload_time": "2024-10-26T02:00:44",
"upload_time_iso_8601": "2024-10-26T02:00:44.592843Z",
"url": "https://files.pythonhosted.org/packages/0d/16/84ff9e4d8cf3f3cbf2e3a9d3a47129f6930f0c271685d9381c52f47ab85f/osm_shortlink-1.1.0-cp39-abi3-macosx_10_12_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "065c31cdebd839bf3518d27da5a84749a03b64512c84821cf63299875328aa73",
"md5": "0fdc09469c1436a96350ed5e7a32c6a7",
"sha256": "ebd652d7aa946879b323f7cd34fb9b7917119efae73148de88c5931a1b81bee0"
},
"downloads": -1,
"filename": "osm_shortlink-1.1.0-cp39-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "0fdc09469c1436a96350ed5e7a32c6a7",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 216367,
"upload_time": "2024-10-26T02:00:46",
"upload_time_iso_8601": "2024-10-26T02:00:46.123309Z",
"url": "https://files.pythonhosted.org/packages/06/5c/31cdebd839bf3518d27da5a84749a03b64512c84821cf63299875328aa73/osm_shortlink-1.1.0-cp39-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d91fa400635478bcd5fb6ba30dc1719f39425658ca089fb3f50f7b4bfe367c2c",
"md5": "8b53a5fa4f81770cb5fc4cf9f474dd62",
"sha256": "51e9736ff6dcbbc0b1633db7c07994ce6dcce79916569a4f8f329a22676f4a62"
},
"downloads": -1,
"filename": "osm_shortlink-1.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "8b53a5fa4f81770cb5fc4cf9f474dd62",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 223318,
"upload_time": "2024-10-26T02:00:47",
"upload_time_iso_8601": "2024-10-26T02:00:47.197975Z",
"url": "https://files.pythonhosted.org/packages/d9/1f/a400635478bcd5fb6ba30dc1719f39425658ca089fb3f50f7b4bfe367c2c/osm_shortlink-1.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6fc8e5fe34a2b14cbceaa2110f440cf9f135df0a2ec681c33834e0cad7b591fc",
"md5": "2e5001e65be40b62de6f5d96fbe30752",
"sha256": "e53e9481e08a80827ce26e171b4976b4ecc23904a36032d88a56cfcb78b6eca3"
},
"downloads": -1,
"filename": "osm_shortlink-1.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "2e5001e65be40b62de6f5d96fbe30752",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 232177,
"upload_time": "2024-10-26T02:00:48",
"upload_time_iso_8601": "2024-10-26T02:00:48.637050Z",
"url": "https://files.pythonhosted.org/packages/6f/c8/e5fe34a2b14cbceaa2110f440cf9f135df0a2ec681c33834e0cad7b591fc/osm_shortlink-1.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cf20cd8622a1a9fc5895fd0d89e531abcef71a5d4486d58d0d99546ee26498c6",
"md5": "dd241358ce129f966f2a4b5f397d6ad1",
"sha256": "138aa7066ba18e9a0559a74ab416aad93051e9a7dee576d84e66ae27f6bcaac8"
},
"downloads": -1,
"filename": "osm_shortlink-1.1.0-cp39-abi3-musllinux_1_2_aarch64.whl",
"has_sig": false,
"md5_digest": "dd241358ce129f966f2a4b5f397d6ad1",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 433758,
"upload_time": "2024-10-26T02:00:50",
"upload_time_iso_8601": "2024-10-26T02:00:50.235580Z",
"url": "https://files.pythonhosted.org/packages/cf/20/cd8622a1a9fc5895fd0d89e531abcef71a5d4486d58d0d99546ee26498c6/osm_shortlink-1.1.0-cp39-abi3-musllinux_1_2_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "61a358a395043a6db36cd48aa949a3b663d80556465a84f97df3c30a1b8267ab",
"md5": "1094d82ff89b0279a5f2d67c864299f2",
"sha256": "a9ba105f7f9ecb2816020c5b10555b75a9f5480aa49a9730e412c6f0a85c5edb"
},
"downloads": -1,
"filename": "osm_shortlink-1.1.0-cp39-abi3-musllinux_1_2_x86_64.whl",
"has_sig": false,
"md5_digest": "1094d82ff89b0279a5f2d67c864299f2",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 415909,
"upload_time": "2024-10-26T02:00:51",
"upload_time_iso_8601": "2024-10-26T02:00:51.987667Z",
"url": "https://files.pythonhosted.org/packages/61/a3/58a395043a6db36cd48aa949a3b663d80556465a84f97df3c30a1b8267ab/osm_shortlink-1.1.0-cp39-abi3-musllinux_1_2_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "532421c63b247bf6fb9a3dc2f5635fc45aeb6c5e04c1151fd05f70d9b76a9931",
"md5": "35c765ec57570f7451158894397d668a",
"sha256": "47c0bf4d3f7ce914ab3bc61dd046bfa9fdc206fab10614f7055a138ef2bfa1f0"
},
"downloads": -1,
"filename": "osm_shortlink-1.1.0-cp39-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "35c765ec57570f7451158894397d668a",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 118580,
"upload_time": "2024-10-26T02:00:53",
"upload_time_iso_8601": "2024-10-26T02:00:53.639997Z",
"url": "https://files.pythonhosted.org/packages/53/24/21c63b247bf6fb9a3dc2f5635fc45aeb6c5e04c1151fd05f70d9b76a9931/osm_shortlink-1.1.0-cp39-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0ee489d19290099449b978d4fc15ac08950fad0ff72c641230d4e4f9bb588c5e",
"md5": "61117732fc74ffd1ffb097e590f4dd0c",
"sha256": "45e344909dc7aaca1b26c620d19e432fcbbfa896cf7e746789dfa28a70f699a5"
},
"downloads": -1,
"filename": "osm_shortlink-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "61117732fc74ffd1ffb097e590f4dd0c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 14483,
"upload_time": "2024-10-26T02:00:55",
"upload_time_iso_8601": "2024-10-26T02:00:55.172945Z",
"url": "https://files.pythonhosted.org/packages/0e/e4/89d19290099449b978d4fc15ac08950fad0ff72c641230d4e4f9bb588c5e/osm_shortlink-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-26 02:00:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Zaczero",
"github_project": "osm-shortlink",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "osm-shortlink"
}