Upload file as layer
Uploads spatial data, processes it, and adds it as a layer to the specified map.
Supported formats:
- Vector: Shapefile (as .zip), GeoJSON, GeoPackage, FlatGeobuf
- Raster: GeoTIFF, DEM
- Point cloud: LAZ, LAS
Once uploaded, Mundi transforms, reprojects, styles, and creates optimized formats for display in the browser. Vector data is converted to PMTiles while raster data is converted to cloud-optimized GeoTIFFs. Point cloud data is compressed to LAZ 1.3.
Returns the new layer details including its unique layer ID. The layer can optionally not be added to the map, but will be faster to add to an existing map later.
with open("brazil_watersheds.gpkg", "rb") as f:
# project ID is PGJSkB1zj7fT, previous map ID is M4NzE8rk4FZS
result = httpx.post(
f"https://app.mundi.ai/api/maps/M4NzE8rk4FZS/layers",
files={"file": ("brazil_watersheds.gpkg", f, "application/octet-stream")},
data={"layer_name": "Amazon Basin Watersheds", "add_layer_to_map": True},
headers={"Authorization": f"Bearer {os.environ['MUNDI_API_KEY']}"}
).json()
assert result["name"] == "Amazon Basin Watersheds"
assert result["dag_child_map_id"] == "M4NzE8rk4FZS"
# use result["dag_child_map_id"] as the new map id, and view this new uploaded layer
# by navigating to https://app.mundi.ai/project/PGJSkB1zj7fT/M4NzE8rk4FZS
subprocess.run(["open", "https://app.mundi.ai/project/PGJSkB1zj7fT/M4NzE8rk4FZS"])
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Request Body required
Section titled “Request Body required ”object
Responses
Section titled “ Responses ”Successful Response
object
The ID of the new map created that contains the changes. Use this ID for further operations on the modified map.
The ID of the original map which was copied to create the new map.
Unique identifier for the newly uploaded layer
Display name of the layer as it appears in the map
Layer type (vector, raster, or point_cloud)
Direct URL to access the layer data (PMTiles for vector, COG for raster)
Status message confirming successful upload
Validation Error