# 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/c4/91/84e28c53d0ef15d8c0adcd6b4a650689737fc858de985ee807c4602e326d/osm_shortlink-1.2.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.2.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": "b4e99b34e332f95a2072d959c20c01b7fbba25e3d6b08feb23a3e329ed67b2b0",
"md5": "fe87e23a7b64abbb11d55ce20df6706e",
"sha256": "c8ea6476a53df7ca36689ac19e51dfbe1b06e96cd5e5b005b5c77932753228f0"
},
"downloads": -1,
"filename": "osm_shortlink-1.2.0-cp313-cp313t-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "fe87e23a7b64abbb11d55ce20df6706e",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.9",
"size": 224286,
"upload_time": "2024-12-17T13:35:42",
"upload_time_iso_8601": "2024-12-17T13:35:42.699034Z",
"url": "https://files.pythonhosted.org/packages/b4/e9/9b34e332f95a2072d959c20c01b7fbba25e3d6b08feb23a3e329ed67b2b0/osm_shortlink-1.2.0-cp313-cp313t-macosx_10_12_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ec310d1ab524d7496d153b863860cde894a7b87768253686a2eaa32e2e0f5385",
"md5": "6bc8e6aa6939f1a02708875e62eb5e7c",
"sha256": "8599b75d5168045da39e6f889e7c6463499f910c03620568c1a91330a13a92ef"
},
"downloads": -1,
"filename": "osm_shortlink-1.2.0-cp313-cp313t-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "6bc8e6aa6939f1a02708875e62eb5e7c",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.9",
"size": 220445,
"upload_time": "2024-12-17T13:35:45",
"upload_time_iso_8601": "2024-12-17T13:35:45.395458Z",
"url": "https://files.pythonhosted.org/packages/ec/31/0d1ab524d7496d153b863860cde894a7b87768253686a2eaa32e2e0f5385/osm_shortlink-1.2.0-cp313-cp313t-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ee049f6223ff378ce931ee429cd90d36ae3c89481cb74a05c6119e3ad1932f9b",
"md5": "5be6fc7580102791c4c2a47783f878cc",
"sha256": "342d45c30e826726551b809fdc0ff4256eb7372af68b9372e909a81738448852"
},
"downloads": -1,
"filename": "osm_shortlink-1.2.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "5be6fc7580102791c4c2a47783f878cc",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.9",
"size": 224945,
"upload_time": "2024-12-17T13:35:46",
"upload_time_iso_8601": "2024-12-17T13:35:46.995310Z",
"url": "https://files.pythonhosted.org/packages/ee/04/9f6223ff378ce931ee429cd90d36ae3c89481cb74a05c6119e3ad1932f9b/osm_shortlink-1.2.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "45407b50a4120a81a1b450556ac11e61f1561b4c1f2de25e643e1e57e03a28ed",
"md5": "374d27ff82df2fe387b390c45a111890",
"sha256": "b3e89d0fe02a77ab6a95ce8ca7c50f9bcf6fb094dfb8d022b19ecc53230c2417"
},
"downloads": -1,
"filename": "osm_shortlink-1.2.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "374d27ff82df2fe387b390c45a111890",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.9",
"size": 234666,
"upload_time": "2024-12-17T13:35:49",
"upload_time_iso_8601": "2024-12-17T13:35:49.964076Z",
"url": "https://files.pythonhosted.org/packages/45/40/7b50a4120a81a1b450556ac11e61f1561b4c1f2de25e643e1e57e03a28ed/osm_shortlink-1.2.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "20e44654cebe8afe49ad4d539e16f0dbab1bbdebb6cf5ae7c5a45e05f8b08f22",
"md5": "664092035c8bc6c33c8ddf1608c4d260",
"sha256": "0eb9a5486e9550ffa2abc8279dd96c75b3a0973fffbabccab63a0f85400b1742"
},
"downloads": -1,
"filename": "osm_shortlink-1.2.0-cp313-cp313t-musllinux_1_2_aarch64.whl",
"has_sig": false,
"md5_digest": "664092035c8bc6c33c8ddf1608c4d260",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.9",
"size": 429315,
"upload_time": "2024-12-17T13:35:52",
"upload_time_iso_8601": "2024-12-17T13:35:52.632259Z",
"url": "https://files.pythonhosted.org/packages/20/e4/4654cebe8afe49ad4d539e16f0dbab1bbdebb6cf5ae7c5a45e05f8b08f22/osm_shortlink-1.2.0-cp313-cp313t-musllinux_1_2_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e4b46e66fbddd79a035e30407af9442e20274e423251956c911c85bcd453663f",
"md5": "6bbf30004ac7f0fa7963c6b7f4d51ca4",
"sha256": "d771f423e1fe5617c5603860e85c6c8586087a8d21a3f143ce38a581f32cfc44"
},
"downloads": -1,
"filename": "osm_shortlink-1.2.0-cp313-cp313t-musllinux_1_2_x86_64.whl",
"has_sig": false,
"md5_digest": "6bbf30004ac7f0fa7963c6b7f4d51ca4",
"packagetype": "bdist_wheel",
"python_version": "cp313",
"requires_python": ">=3.9",
"size": 422267,
"upload_time": "2024-12-17T13:35:56",
"upload_time_iso_8601": "2024-12-17T13:35:56.101876Z",
"url": "https://files.pythonhosted.org/packages/e4/b4/6e66fbddd79a035e30407af9442e20274e423251956c911c85bcd453663f/osm_shortlink-1.2.0-cp313-cp313t-musllinux_1_2_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a621bf0d11b3306c602e3a15190754d836b30d78c9db1eac66c88eb5a5f83172",
"md5": "172ece5e25f08b29254237536e2b717e",
"sha256": "9fb22d7c766094727a359d7a0caead19d9374bb87b4845780f52192a2c8fbc2e"
},
"downloads": -1,
"filename": "osm_shortlink-1.2.0-cp39-abi3-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "172ece5e25f08b29254237536e2b717e",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 224241,
"upload_time": "2024-12-17T13:35:59",
"upload_time_iso_8601": "2024-12-17T13:35:59.048251Z",
"url": "https://files.pythonhosted.org/packages/a6/21/bf0d11b3306c602e3a15190754d836b30d78c9db1eac66c88eb5a5f83172/osm_shortlink-1.2.0-cp39-abi3-macosx_10_12_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4618d324550b3afaa735a0cf1b635eb749c87bda381b9c33b1825f7b68742011",
"md5": "6c4e82f1e20090ee0455dc25027a2f0a",
"sha256": "1f6ebaff7153f7a6bd72b935a97babbb0c0f3c2b2c993b48115a5c1547c0c1f1"
},
"downloads": -1,
"filename": "osm_shortlink-1.2.0-cp39-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "6c4e82f1e20090ee0455dc25027a2f0a",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 220398,
"upload_time": "2024-12-17T13:36:00",
"upload_time_iso_8601": "2024-12-17T13:36:00.521179Z",
"url": "https://files.pythonhosted.org/packages/46/18/d324550b3afaa735a0cf1b635eb749c87bda381b9c33b1825f7b68742011/osm_shortlink-1.2.0-cp39-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2e0015edfcdba2756669d9f4aba84c019a21d07f375e620249315d72a5a5fc04",
"md5": "c48ab23157eca8f8c4d9d4ba480d7e86",
"sha256": "940868eb5821539e4f87939d7cbeb5a5cd56d9711d06d34d7e8b01cb856625c6"
},
"downloads": -1,
"filename": "osm_shortlink-1.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "c48ab23157eca8f8c4d9d4ba480d7e86",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 224875,
"upload_time": "2024-12-17T13:36:03",
"upload_time_iso_8601": "2024-12-17T13:36:03.253879Z",
"url": "https://files.pythonhosted.org/packages/2e/00/15edfcdba2756669d9f4aba84c019a21d07f375e620249315d72a5a5fc04/osm_shortlink-1.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "31efafaf0169c1524c8d3398dfb90c827e74343f7b8d5ca48258d0b09919618b",
"md5": "a83f0ecb2827b788d3214b7f1fdb5fdb",
"sha256": "6cd480fe127fbab32c918e7a7b7400e5920194fcef6831dec11977c997c4ee2a"
},
"downloads": -1,
"filename": "osm_shortlink-1.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "a83f0ecb2827b788d3214b7f1fdb5fdb",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 234595,
"upload_time": "2024-12-17T13:36:06",
"upload_time_iso_8601": "2024-12-17T13:36:06.009765Z",
"url": "https://files.pythonhosted.org/packages/31/ef/afaf0169c1524c8d3398dfb90c827e74343f7b8d5ca48258d0b09919618b/osm_shortlink-1.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "02215ac2e924dce86d64fc82fc27ee244d658c9a9750e72e74b72996a56846a9",
"md5": "52b78c98d98efcfb84a2c1b1f14e1495",
"sha256": "b9be363fbd1f97cdc542ed55e143a7ba4191e7b982567861847909c5c84938dd"
},
"downloads": -1,
"filename": "osm_shortlink-1.2.0-cp39-abi3-musllinux_1_2_aarch64.whl",
"has_sig": false,
"md5_digest": "52b78c98d98efcfb84a2c1b1f14e1495",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 429234,
"upload_time": "2024-12-17T13:36:08",
"upload_time_iso_8601": "2024-12-17T13:36:08.614186Z",
"url": "https://files.pythonhosted.org/packages/02/21/5ac2e924dce86d64fc82fc27ee244d658c9a9750e72e74b72996a56846a9/osm_shortlink-1.2.0-cp39-abi3-musllinux_1_2_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a02a29b2cf6d4daa3fb5daef9fcc9d1af95961f6556756883a6f17fa2587013b",
"md5": "c2ca699b202451779b2ed39cba914dc1",
"sha256": "524ad11729e441dc6676fa6c2cc2becef7af6750cab4695d22f71dab4e91dd0d"
},
"downloads": -1,
"filename": "osm_shortlink-1.2.0-cp39-abi3-musllinux_1_2_x86_64.whl",
"has_sig": false,
"md5_digest": "c2ca699b202451779b2ed39cba914dc1",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 422190,
"upload_time": "2024-12-17T13:36:10",
"upload_time_iso_8601": "2024-12-17T13:36:10.087973Z",
"url": "https://files.pythonhosted.org/packages/a0/2a/29b2cf6d4daa3fb5daef9fcc9d1af95961f6556756883a6f17fa2587013b/osm_shortlink-1.2.0-cp39-abi3-musllinux_1_2_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "08a78dc550ff736ad6d261f8d284aff30aca12a0f2c08a5c4bb4f9452e45fe76",
"md5": "e06944373a2b208ccff5bba30ebc3ed3",
"sha256": "ff3517ed44f843efbe27018341e6cee5eaafde3db06e311fcca7efd043337d9c"
},
"downloads": -1,
"filename": "osm_shortlink-1.2.0-cp39-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "e06944373a2b208ccff5bba30ebc3ed3",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 118248,
"upload_time": "2024-12-17T13:36:12",
"upload_time_iso_8601": "2024-12-17T13:36:12.708819Z",
"url": "https://files.pythonhosted.org/packages/08/a7/8dc550ff736ad6d261f8d284aff30aca12a0f2c08a5c4bb4f9452e45fe76/osm_shortlink-1.2.0-cp39-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c49184e28c53d0ef15d8c0adcd6b4a650689737fc858de985ee807c4602e326d",
"md5": "7e944f6320b4918ae44952e14c31a5e8",
"sha256": "483fe5e9df6ddf8623dd3639c38b0b91633ce1da6acb965c52c49932cc2b90e4"
},
"downloads": -1,
"filename": "osm_shortlink-1.2.0.tar.gz",
"has_sig": false,
"md5_digest": "7e944f6320b4918ae44952e14c31a5e8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 17545,
"upload_time": "2024-12-17T13:36:13",
"upload_time_iso_8601": "2024-12-17T13:36:13.799794Z",
"url": "https://files.pythonhosted.org/packages/c4/91/84e28c53d0ef15d8c0adcd6b4a650689737fc858de985ee807c4602e326d/osm_shortlink-1.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-17 13:36:13",
"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"
}