Connecting To the API

To work with project kiwi via the python API, you will need to register and get your API key from here.

# import the Connector class
from projectkiwi.connector import Connector

# connect to the API
conn = Connector(key="****key****")

Uploading Data

Our platform is designed to work with GeoTIFF files, you can find some examples here. Either upload your data to a project through the web interface or via the API:

# get all the projects
projects = conn.getProjects()

# add the data to the first project
imagery_id = conn.addImagery("./path/to/mydata.tif", "My layer Name", projects[0].id)

Reading Tiles as Numpy Arrays

https://project-kiwi.org/imgs/figs/getTile.png
import matplotlib.pyplot as plt

project = conn.getProjects()[0]

imagery = conn.getImagery(project.id)[0]

# get a list of valid tiles
tile = conn.getTileList(imagery.id, project.id, zoom=17)[0]

# download the tile in numpy format
numpy_tile = conn.getTile(tile.imagery_id, tile.z, tile.x, tile.y)

# show the tile
plt.imshow(numpy_tile)

Reading Annotations

# choose a project
project = projects[0]

# read all annotations in a project
annotations = conn.getAnnotations(project.id)

# get annotations as geojson
print(annotations[0].geoJSON())

# result
{
  "type": "Feature",
  "geometry": {
      "type": "Polygon",
      "coordinates": [
          [-87.612448, 41.867452],
          [-87.605238, 41.867452],
          [-87.605238, 41.852301],
          [-87.612448, 41.852301],
          [-87.612448, 41.867452]
      ]
  },
  "properties": {
      "label_id": 374,
      "name": "airport"
  }
}