up42¶
Authentication¶
authenticate()¶
The authenticate()
function allows you to access UP42 SDK requests. For more information, see Authentication.
authenticate(
cfg_file,
project_id,
project_api_key,
)
Arguments
Argument | Overview |
---|---|
cfg_file |
Union[str, Path] The file path to the JSON file containing the project ID and the API key. |
project_id |
str The project ID. |
project_api_key |
str The project API key. |
Example
# Authenticate directly in code
up42.authenticate(
project_id="your-project-ID",
project_api_key="your-project-API-key",
)
# Authenticate in a configuration file
up42.authenticate(cfg_file="config.json")
Logging¶
tools.settings()¶
The tools.settings()
function allows you to enable logging.
tools.settings(log)
Arguments
Argument | Overview |
---|---|
log |
bool Determines logging enabling:
True . |
Example
up42.tools.settings(log=True)
Credits¶
get_credits_balance()¶
The get_credits_balance()
function returns your account balance, in credits.
get_credits_balance()
The returned format is dict
.
Example
up42.get_credits_balance()
Blocks¶
get_block_coverage()¶
The get_block_coverage()
function returns the spatial coverage of the block.
get_block_coverage(block_id)
The returned format is dict
.
Arguments
Argument | Overview |
---|---|
block_id |
str / required The block ID. |
Example
up42.get_block_coverage(block_id="f73c60f6-3f3c-4120-96cf-62b8d3019346")
get_block_details()¶
The get_block_details()
function returns information about a specific block.
get_block_details(
block_id,
as_dataframe,
)
The returned format is dict
.
Arguments
Argument | Overview |
---|---|
block_id |
str / required The block ID. |
as_dataframe |
bool Determines how to return the information:
False . |
Example
up42.get_block_details(
block_id="045019bb-06fc-4fa1-b703-318725b4d8af",
as_dataframe=True,
)
get_blocks()¶
The get_blocks()
function returns a list of all blocks on the marketplace.
get_blocks(
block_type,
basic,
as_dataframe,
)
The returned format is Union[List[Dict], dict]
.
Arguments
Argument | Overview |
---|---|
block_type |
str Filters blocks:
|
basic |
bool Determines how to return a list of blocks:
True . |
as_dataframe |
bool Determines how to return the information:
False . |
Example
up42.get_blocks(
block_type="data",
basic=True,
as_dataframe=True,
)
validate_manifest()¶
The validate_manifest()
function allows you to validate the manifest of your custom block.
validate_manifest(path_or_json)
The returned format is dict
.
Arguments
Argument | Overview |
---|---|
path_or_json |
Union[str, Path, dict] / required The file path to the manifest to be validated. |
Example
validate_manifest(path_or_json="/Users/max.mustermann/Desktop/UP42Manifest.json")
Geometries¶
get_example_aoi()¶
The get_example_aoi()
function returns an example AOI.
get_example_aoi(
location,
as_dataframe,
)
The returned format is Union[dict, GeoDataFrame]
.
Arguments
Argument | Overview |
---|---|
location |
str A defined location. The allowed values:
Berlin . |
as_dataframe |
bool Determines how to return the information:
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.
read_vector_file(
filename,
as_dataframe,
)
The returned format 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:
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.
draw_aoi()
The returned format is folium.Map
.
Example
up42.draw_aoi()
Visualization¶
viztools.folium_base_map()¶
The viztools.folium_base_map()
function returns a Folium map with the UP42 logo. Use it to visualize your assets.
viztools.folium_base_map(
lat,
lon,
zoom_start,
width_percent,
layer_control,
)
The returned format 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:
False . |
Example
up42.viztools.folium_base_map(
lat=48.8584,
lon=2.2945,
zoom_start=40,
width_percent="100%",
layer_control=False,
)