Skip to content
master
Switch branches/tags
Code

Latest commit

Signed-off-by: Kharude, Sachin <sachin.kharude@here.com>
a6bea88

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
ci
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

HERE Location Services for Python

Tests Documentation Status codecov PyPI - Status PyPI - Python Version PyPI - Python Version PyPI - License Downloads Conda (channel only) Conda Downloads Anaconda-Server Badge Binder

A Python client for HERE Location Services.

Usage

Geocoding using HERE Geocoding & Search API.

Geocoding Example

Prerequisites

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 pip command 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_KEY which you can set like this (with a valid value, of course):
    $ export LS_API_KEY="MY-LS-API-KEY"

Installation

  • Install HERE Location Services for Python with conda from the Anaconda conda-forge channel using the below command:

    $ conda install -c conda-forge here-location-services
  • Install HERE Location Services for Python from PyPI using the below command:

    $ pip install here-location-services
  • Install HERE Location Services for Python from GitHub using the below command:

    $ pip install -e git+https://github.com/heremaps/here-location-services-python#egg=here-location-services

Run Test Suite

Run the test suite using below commands:

$ pip install -r requirements_dev.txt
$ pytest -v --cov=here_location_services tests

Documentation

Documentation 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.sh

Hello World Example

This 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))

License

Copyright (C) 2019-2021 HERE Europe B.V.

See the License file in the root of this project for license details.