Welcome to Terralego’s documentation!

Getting started

Install using pip:

pip install terralego

Set your credentials using the environment variables:

export TERRALEGO_USER="my_user"
export TERRALEGO_PASSWORD="my_password"

You can now use terralego:

from terralego import geocoding

results = geocoding.search('paris france')

Contents:

Geocoding

terralego.geocoding.autocomplete(text, params=None)

Autocomplete locations from a string.

Parameters:
  • text – The string which will be used to do the autocomplete.
  • params – A dict including other get parameters.
Returns:

A geojson including the results.

terralego.geocoding.reverse(lat, long, params=None)

Search addresses from a location.

Parameters:
  • lat – The latitude of the location.
  • long – The longitude of the location.
  • params – A dict including other get parameters.
Returns:

A geojson including the results.

terralego.geocoding.search(text, params=None)

Search locations from a string.

Parameters:
  • text – The string which will be used to do the search.
  • params – A dict including other get parameters.
Returns:

A geojson including the results.

Geodirectory

terralego.geodirectory.closest(entry_id, tags=None)

Get the closest entry.

Parameters:
  • entry_id – The id of the entry on which to get the closest one.
  • tags – Optional, a list of tags to filter the entry which can be the closests.
Returns:

A geojson describing the entry as a python dictionnary. Raise 404 if no entry are found.

terralego.geodirectory.closest_from(lat, long, tags=None, dist=None)

Get the closest entry from the point.

Parameters:
  • lat – The latitude of the point.
  • long – The longitude of the point.
  • tags – Optional, a list of tags to filter the entry which can be the closests.
  • dist – Optional, a distance in meters.
Returns:

A geojson describing the entry as a python dictionnary. Raise 404 if no entry are found.

terralego.geodirectory.create_entry(geometry, tags=None)

Create a new entry.

Parameters:
  • geometry – A WKT string representing the geometry of the entry or a dict representing the geojson.
  • tags – A list of string describing the entry. Can be used for filtering later on.
Returns:

A geojson describing the entry as a python dictionnary.

terralego.geodirectory.delete_entry(entry_id)

Delete an entry.

Parameters:entry_id – The id of the entry.
terralego.geodirectory.get_entry(entry_id)

Get an entry.

Parameters:entry_id – The id of the entry.
Returns:A geojson describing the entry as a python dictionnary.
terralego.geodirectory.update_entry(entry_id, geometry, tags=None)

Update an entry.

Parameters:
  • entry_id – The id of the entry.
  • geometry – A WKT string representing the geometry of the entry or a dict representing the geojson.
  • tags – A list of string describing the entry. Can be used for filtering later on.
Returns:

A geojson describing the updated entry as a python dictionnary.

Indices and tables