Skip to main content

HERE Location Services for Python

Project description

HERE Location Services for Python

Tests Documentation Status 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 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

To run the test suite you can do this locally, which should provide a test coverage of 100%:

$ 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

here-location-services-0.1.0.tar.gz (17.3 kB view hashes)

Uploaded Source

Built Distribution

here_location_services-0.1.0-py2.py3-none-any.whl (16.3 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page