Skip to content

up42

The up42 class is the base library module imported to Python. It provides the elementary functionality that is not bound to a specific class of the UP42 structure.

Authentication

authenticate()

The authenticate() function allows you to access UP42 SDK requests. For more information, see Authentication.

Arguments
Argument Overview
cfg_file Union[str, Path]
The file path to the JSON file containing the username and password.
username str
The email address used for logging into the console.
password str
The password used for logging into the console.
Example
# Authenticate directly in code

up42.authenticate(
    username="<your-email-address>",
    password="<your-password>",
)

# Authenticate in a configuration file

up42.authenticate(cfg_file="config.json")

Logging

tools.settings()

The tools.settings() function allows you to enable logging.

Arguments
Argument Overview
log bool
Determines logging enabling:
  • True: enable logging.
  • False: disable logging.
The default value is True.
Example
up42.tools.settings(log=True)

Credits

get_credits_balance()

The get_credits_balance() function returns your account balance, in credits.

The returned data type is dict.

Example
up42.get_credits_balance()

Geometries

get_example_aoi()

The get_example_aoi() function returns an example AOI.

The returned data type is Union[dict, GeoDataFrame].

Arguments
Argument Overview
location str
A defined location. The allowed values are as follows:
  • Berlin
  • Washington
The default value is Berlin.
as_dataframe bool
Determines how to return the information:
  • True: return DataFrame.
  • False: return JSON.
The default value is False.
Example
up42.get_example_aoi(
    location="Washington",
    as_dataframe=True,
)

read_vector_file()

The read_vector_file() function allows you to upload your geometry from a vector file.

The returned data type is Union[dict, GeoDataFrame].

Arguments
Argument Overview
filename str
The file path to the vector file containing the geometry. The default value is aoi.geojson.
as_dataframe bool
Determines how to return the information:
  • True: return DataFrame.
  • False: return JSON.
The default value is False.
Example
up42.read_vector_file(
    filename="/Users/max.mustermann/Desktop/aoi.geojson",
    as_dataframe=True,
)

draw_aoi()

The draw_aoi() function allows you to draw an AOI on an interactive map. To be able to use the function, install plotting functionalities first.

The returned data type is folium.Map.

Example
up42.draw_aoi()

Visualization

viztools.folium_base_map()

The function is deprecated.

The viztools.folium_base_map() function returns a Folium map with the UP42 logo. Use it to visualize your assets.

The returned data type is folium.Map.

Arguments
Argument Overview
lat float
The latitude. The default value is 52.49190032214706.
lon float
The longitude. The default value is 13.39117252959244.
zoom_start int
The value of initial zooming in on the coordinates. The default value is 14.
width_percent str
The map width in percentage. The default value is 95%.
layer_control bool
Determines how to return the map:
  • True: return a basic map.
  • False: return a map with visualized geospatial data.
The default value is False.
Example
up42.viztools.folium_base_map(
    lat=48.8584,
    lon=2.2945,
    zoom_start=40,
    width_percent="100%",
    layer_control=False,
)

Webhooks

get_webhook_events()

The get_webhook_events() function returns all available webhook events. For more information, see Webhooks.

The returned data type is dict.

Example
up42.get_webhook_events()

create_webhook()

The create_webhook() function allows you to register a new webhook in the system.

The returned data type is Webhook.

Arguments
Argument Overview
name str / required
The name of the webhook.
url str / required
The URL of the webhook.
events list[str] / required
A list of events that trigger the webhook. The allowed value is order.status.
active bool
Whether this webhook should be active after the update:
  • True: webhook is active.
  • False: webhook isn't active.
The default value is False.
secret str
The secret used to generate webhook signatures.
Example
up42.create_webhook(
    name="new-webhook",
    url="https://receiving-url.com",
    events=["order.status"],
    active=True,
    secret="QWZTFnMEXhqZKNmu",
)

get_webhooks()

The get_webhooks() function returns all registered webhooks for this workspace.

The returned data type is list[Webhook].

Arguments
Argument Overview
return_json bool
Determines how to return webhooks:
  • True: return JSON.
  • False: return webhook class objects.
The default value is False.
Example
up42.get_webhooks(return_json=False)