# simple-mapillary-python-sdk [![PyPI](https://img.shields.io/pypi/v/simple_mapillary?color=2BAF2B)](https://pypi.org/project/simple_mapillary/)
Simplified Python library for accessing the Mapillary API.
For a more complete library, check out the official [mapillary-python-sdk](https://github.com/mapillary/mapillary-python-sdk).
## Installation
```bash
pip install simple-mapillary
```
Or clone the repository and install it manually (If you want to modify the code):
```bash
git clone https://github.com/ibaiGorordo/simple-mapillary-python-sdk
cd simple-mapillary-python-sdk
pip install .
```
## Setup
First, you need to get an access token. To get one:
- Visit https://www.mapillary.com/dashboard/developer, go to 'developers',
- Then, click 'register application', register a new application (read access is enough),
- Finally, copy the 'Client Token'
Then, pass the token as an argument to the `set_access_token()` function.
## Example (Read image)
```python
from simple_mapillary import Image, set_access_token
import cv2
token = ""
set_access_token(token)
image_id = "1200479493800436"
image = Image(image_id)
img = image.get_cvimage()
cv2.imshow('image', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
```
<p align="center">
<img src="https://raw.githubusercontent.com/ibaiGorordo/simple-mapillary-python-sdk/main/doc/img/retrieve_img.png" />
</p>
## Example (Read image with semantic map)
```python
from simple_mapillary import Image, set_access_token
from simple_mapillary.image import draw_detections
import cv2
# TODO: Set the token here
token = ''
set_access_token(token)
image_id = "279996174671586"
image = Image(image_id)
img = image.get_cvimage()
detections = image.get_detections()
segmentation_img = draw_detections(img, detections)
comb_img = cv2.addWeighted(img, 0.6, segmentation_img, 0.4, 0)
cv2.imshow('image', comb_img)
cv2.waitKey(0)
cv2.destroyAllWindows()
```
<p align="center">
<img src="https://raw.githubusercontent.com/ibaiGorordo/simple-mapillary-python-sdk/main/doc/img/semantic_img.png" />
</p>
Raw data
{
"_id": null,
"home_page": "https://github.com/ibaiGorordo/simple-mapillary-python-sdk",
"name": "simple-mapillary",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Ibai Gorordo",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/76/9a/98e724446cb38e137634fff448f3f630060a1da8b8142eeed89ec0bcce5d/simple_mapillary-0.0.4.tar.gz",
"platform": null,
"description": "# simple-mapillary-python-sdk [![PyPI](https://img.shields.io/pypi/v/simple_mapillary?color=2BAF2B)](https://pypi.org/project/simple_mapillary/)\n Simplified Python library for accessing the Mapillary API. \n For a more complete library, check out the official [mapillary-python-sdk](https://github.com/mapillary/mapillary-python-sdk).\n\n## Installation\n```bash\npip install simple-mapillary\n```\n\nOr clone the repository and install it manually (If you want to modify the code):\n```bash\ngit clone https://github.com/ibaiGorordo/simple-mapillary-python-sdk\ncd simple-mapillary-python-sdk\npip install .\n```\n\n## Setup\nFirst, you need to get an access token. To get one:\n- Visit https://www.mapillary.com/dashboard/developer, go to 'developers',\n- Then, click 'register application', register a new application (read access is enough),\n- Finally, copy the 'Client Token'\n\nThen, pass the token as an argument to the `set_access_token()` function.\n\n## Example (Read image)\n```python\nfrom simple_mapillary import Image, set_access_token\nimport cv2\n\ntoken = \"\"\nset_access_token(token)\n\nimage_id = \"1200479493800436\"\nimage = Image(image_id)\n\nimg = image.get_cvimage()\n\ncv2.imshow('image', img)\ncv2.waitKey(0)\ncv2.destroyAllWindows()\n```\n\n<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/ibaiGorordo/simple-mapillary-python-sdk/main/doc/img/retrieve_img.png\" />\n</p>\n\n## Example (Read image with semantic map)\n```python\nfrom simple_mapillary import Image, set_access_token\nfrom simple_mapillary.image import draw_detections\nimport cv2\n\n# TODO: Set the token here\ntoken = ''\nset_access_token(token)\n\nimage_id = \"279996174671586\"\nimage = Image(image_id)\n\nimg = image.get_cvimage()\n\ndetections = image.get_detections()\nsegmentation_img = draw_detections(img, detections)\n\ncomb_img = cv2.addWeighted(img, 0.6, segmentation_img, 0.4, 0)\n\ncv2.imshow('image', comb_img)\ncv2.waitKey(0)\ncv2.destroyAllWindows()\n```\n<p align=\"center\">\n <img src=\"https://raw.githubusercontent.com/ibaiGorordo/simple-mapillary-python-sdk/main/doc/img/semantic_img.png\" />\n</p>\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Simplified Python library for accessing the Mapillary API.",
"version": "0.0.4",
"project_urls": {
"Homepage": "https://github.com/ibaiGorordo/simple-mapillary-python-sdk"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2f7d8bde855af098886c709500a48a0caed39e28b0a1d1a1db7e59de6d7f9b6b",
"md5": "470b1425eab88ba3434364a9c6cdad1b",
"sha256": "57c6fa3d9f243124b4b9e603df4586851ab3a6755fc558c399053d2e48f6e517"
},
"downloads": -1,
"filename": "simple_mapillary-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "470b1425eab88ba3434364a9c6cdad1b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 7742,
"upload_time": "2023-08-09T11:44:53",
"upload_time_iso_8601": "2023-08-09T11:44:53.001047Z",
"url": "https://files.pythonhosted.org/packages/2f/7d/8bde855af098886c709500a48a0caed39e28b0a1d1a1db7e59de6d7f9b6b/simple_mapillary-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "769a98e724446cb38e137634fff448f3f630060a1da8b8142eeed89ec0bcce5d",
"md5": "82d0da09f33e8ed31eea5f21ff6075c2",
"sha256": "45d2f2060a76e306eb2e84f68311c268fbc30183ddde922e86c7a6078a7f58d3"
},
"downloads": -1,
"filename": "simple_mapillary-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "82d0da09f33e8ed31eea5f21ff6075c2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6866,
"upload_time": "2023-08-09T11:44:54",
"upload_time_iso_8601": "2023-08-09T11:44:54.522970Z",
"url": "https://files.pythonhosted.org/packages/76/9a/98e724446cb38e137634fff448f3f630060a1da8b8142eeed89ec0bcce5d/simple_mapillary-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-09 11:44:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ibaiGorordo",
"github_project": "simple-mapillary-python-sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "simple-mapillary"
}