A Python client for HERE Location Services.
Geocoding using HERE Geocoding & Search API.
Before you can install HERE Location Services for Python, run its test-suite, or use the example notebooks to make sure you meet the following prerequisites:
- A Python installation, 3.6+ recommended, with the
pipcommand available to install dependencies. - A HERE developer account, freely available under HERE Developer Portal.
- An API key from the HERE Developer Portal, in an environment variable named
LS_API_KEYwhich you can set like this (with a valid value, of course):$ export LS_API_KEY="MY-LS-API-KEY"
-
Install
HERE Location Services for Pythonwith conda from the Anaconda conda-forge channel using the below command:$ conda install -c conda-forge here-location-services
-
Install
HERE Location Services for Pythonfrom PyPI using the below command:$ pip install here-location-services
-
Install
HERE Location Services for Pythonfrom GitHub using the below command:$ pip install -e git+https://github.com/heremaps/here-location-services-python#egg=here-location-services
Run the test suite using below commands:
$ pip install -r requirements_dev.txt
$ pytest -v --cov=here_location_services testsDocumentation is available here.
Run the below commands to build the docs locally:
$ pip install -e .
$ pip install -r requirements_dev.txt
$ sh scripts/build_docs.shThis is a tiny "Hello World" like example that you can run to geocode the given address right away. Just make sure to use your own real API key.
import json
import os
from here_location_services import LS
LS_API_KEY = os.environ.get("LS_API_KEY") # Get API KEY from environment.
ls = LS(api_key=LS_API_KEY)
address = "Invalidenstr 116, 10115 Berlin, Germany"
geo = ls.geocode(query=address)
print(json.dumps(geo.to_geojson(), indent=2, sort_keys=True))Copyright (C) 2019-2021 HERE Europe B.V.
See the License file in the root of this project for license details.
#trigger built 5