LocationIQ provides flexible enterprise-grade location based solutions. We work with developers, startups and enterprises worldwide serving billions of requests everyday. This page provides an overview of the technical aspects of our API and will help you get started.
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 1.1.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
Python 2.7 and 3.4+
If the python package is hosted on a repository, you can install directly using:
pip install git+https://github.com/location-iq/locationiq-python-client.git
(you may need to run pip
with root permission: sudo pip install git+https://github.com/location-iq/locationiq-python-client.git
)
Then import the package:
import locationiq
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import locationiq
Please follow the installation procedure and then run the following:
from __future__ import print_function
import time
import locationiq
from locationiq.rest import ApiException
from pprint import pprint
configuration = locationiq.Configuration()
# Configure API key authorization: key
configuration.api_key['key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['key'] = 'Bearer'
# Defining host is optional and default to https://eu1.locationiq.com/v1
configuration.host = "https://eu1.locationiq.com/v1"
# Enter a context with an instance of the API client
with locationiq.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = locationiq.AutocompleteApi(api_client)
q = 'Empire state' # str | Address to geocode
normalizecity = 1 # int | For responses with no city value in the address section, the next available element in this order - city_district, locality, town, borough, municipality, village, hamlet, quarter, neighbourhood - from the address section will be normalized to city. Defaults to 1 for SDKs.
limit = 10 # int | Limit the number of returned results. Default is 10. (optional) (default to 10)
viewbox = '-132.84908,47.69382,-70.44674,30.82531' # str | The preferred area to find search results. To restrict results to those within the viewbox, use along with the bounded option. Tuple of 4 floats. Any two corner points of the box - `max_lon,max_lat,min_lon,min_lat` or `min_lon,min_lat,max_lon,max_lat` - are accepted in any order as long as they span a real box. (optional)
bounded = 1 # int | Restrict the results to only items contained with the viewbox (optional)
countrycodes = 'us' # str | Limit search to a list of countries. (optional)
accept_language = 'en' # str | Preferred language order for showing search results, overrides the value specified in the Accept-Language HTTP header. Defaults to en. To use native language for the response when available, use accept-language=native (optional)
tag = 'place' # str | Restricts the autocomplete search results to elements of specific OSM class and type. Example - To restrict results to only class place and type city: tag=place:city, To restrict the results to all of OSM class place: tag=place (optional)
try:
api_response = api_instance.autocomplete(q, normalizecity, limit=limit, viewbox=viewbox, bounded=bounded, countrycodes=countrycodes, accept_language=accept_language, tag=tag)
pprint(api_response)
except ApiException as e:
print("Exception when calling AutocompleteApi->autocomplete: %s\n" % e)
All URIs are relative to https://eu1.locationiq.com/v1
Class | Method | HTTP request | Description |
---|---|---|---|
AutocompleteApi | autocomplete | GET /autocomplete.php | |
BalanceApi | balance | GET /balance.php | |
DirectionsApi | directions | GET /directions/driving/{coordinates} | Directions Service |
MatchingApi | matching | GET /matching/driving/{coordinates} | Matching Service |
MatrixApi | matrix | GET /matrix/driving/{coordinates} | Matrix Service |
NearestApi | nearest | GET /nearest/driving/{coordinates} | Nearest Service |
SearchApi | search | GET /search.php | Forward Geocoding |
ReverseApi | reverse | GET /reverse.php | Reverse Geocoding |
- Address
- Balance
- Daybalance
- DirectionsDirections
- DirectionsDirectionsRoutes
- DirectionsMatching
- DirectionsMatrix
- DirectionsMatrixSources
- DirectionsNearest
- DirectionsNearestWaypoints
- Error
- Location
- Matchquality
- Namedetails
- Type: API key
- API key parameter name: key
- Location: URL query string