A Python wrapper for the MapHub API
Project description
MapHub
Installation
pip
pip install maphub
Usage
Python package
This example demonstrates how to upload a Map from the local path to a MapHub folder with the name France.
from maphub import MapHubClient
client = MapHubClient(api_key="your-api-key")
personal_workspace = client.workspace.get_personal_workspace()
root_folder = client.folder.get_root_folder(personal_workspace["id"])
france_folder = client.folder.create_folder("France", root_folder["folder"]["id"])
client.maps.upload_map(
map_name="France Population",
folder_id=france_folder['id'],
public=False,
path="path/to/GIS/data.gpkg"
)
Note: The direct endpoint methods (e.g.,
client.create_project(),client.upload_map()) are deprecated and will be removed in a future version. Use the endpoint classes instead (e.g.,client.folder.create_folder(),client.map.upload_map()).
CLI
The MapHub CLI provides a command-line interface for interacting with the MapHub API. It allows you to authenticate with an API key and upload maps to your folders.
Authentication
Before using the CLI, you need to authenticate with your MapHub API key:
maphub auth YOUR_API_KEY
This will save your API key to ~/.maphub/config.json for future use.
Uploading Maps
To upload a GIS file to your root folder:
maphub upload path/to/your/file.gpkg
The map name will be extracted from the file name (without extension).
To upload a GIS file to a specific folder:
maphub upload path/to/your/file.gpkg --folder-id YOUR_FOLDER_ID
If you don't specify a folder ID, the map will be uploaded to your root folder.
To upload a GIS file with a custom map name:
maphub upload path/to/your/file.gpkg --map-name "My Custom Map Name"
If you don't specify a map name, it will be extracted from the file name (without extension).
Cloning Maps and Folders
To clone a map or folder from MapHub to your local machine:
maphub clone MAP_OR_FOLDER_ID
This will clone the map or folder to the current directory.
To specify an output directory:
maphub clone MAP_OR_FOLDER_ID --output path/to/output/directory
Pulling Changes
To pull the latest changes from MapHub to your local clone:
maphub pull
This command should be run from within a directory that was previously cloned. It will update any maps that have changed on the server.
Pushing Changes
To push your local changes back to MapHub:
maphub push
This command should be run from within a directory that was previously cloned. It will upload any maps that have changed locally.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file maphub-0.2.5.tar.gz.
File metadata
- Download URL: maphub-0.2.5.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9e6e1df2c9f6178343a0ec4dda39d7fd950a289f528fb28ad3936d76e69552e
|
|
| MD5 |
ab56d60c527752e52116dff62ac6c3da
|
|
| BLAKE2b-256 |
74e584fdf89b2c31aa6c52066617b803da185662cb739f5249337da6249d51ca
|
File details
Details for the file maphub-0.2.5-py3-none-any.whl.
File metadata
- Download URL: maphub-0.2.5-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
814b1861c0589132db208cf710b1f7ee9603a8cd802fbea244419c8e276d49d4
|
|
| MD5 |
8d05bc8a5e80992586aded801fd397c9
|
|
| BLAKE2b-256 |
e323959dbd034de8f548a7d70e13358c9c65afc9948d9e16a8c7ae46e9ebbf17
|