from picterra import APIClient # Replace this with the id of one of your detectors detector_id = 'd552605b-6972-4a68-8d51-91e6cb531c24' # Set the PICTERRA_API_KEY environment variable to define your API key client = APIClient() print('Uploading raster...') raster_id = client.upload_raster('data/raster1.tif', name='a nice raster') print('Upload finished, starting detector...') result_id = client.run_detector(detector_id, raster_id) client.download_result_to_file(result_id, 'result.geojson') print('Detection finished, results are in result.geojson')
from picterra import APIClient # Replace this with the id of one of your detectors detector_id = 'd552605b-6972-4a68-8d51-91e6cb531c24' # Replace this with the id of a folder in which the # raster should be uploaded. folder_id = '63207fe9-32b8-410f-a72d-00803cca7bf3' # Set the PICTERRA_API_KEY environment variable to define your API key client = APIClient() print('Uploading raster...') raster_id = client.upload_raster('data/raster1.tif', name='a nice raster', folder_id=folder_id, captured_at='2020-01-01T12:34:45.789Z') print('Upload finished, starting detector...') result_id = client.run_detector(detector_id, raster_id) client.download_result_to_feature_collection(result_id, 'result.geojson') print('Detection finished, results are in result.geojson')
#!/usr/bin/env python3 from pprint import pprint from picterra import APIClient # Set the PICTERRA_API_KEY environment variable to define your API key client = APIClient() # The Id of a folder/project you own folder_id = "7ec40c11-f181-436a-9d33-d7b3f63e0e0f" raster_id = client.upload_raster('data/raster1.tif', name='A nice raster') print('Uploaded raster=', raster_id) for raster in client.list_rasters(): pprint('raster %s' % "\n".join(["%s=%s" % item for item in raster.items()])) raster_id = client.upload_raster( 'data/raster1.tif', name='Another nice raster in a nice folder', folder_id=folder_id, captured_at="2020-01-01T12:34:56.789Z" ) print('Uploaded raster=', raster_id) for raster in client.list_rasters(folder_id): pprint('raster %s' % "\n".join(["%s=%s" % item for item in raster.items()])) client.delete_raster(raster_id) print('Deleted raster=', raster_id)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from pprint import pprint from picterra import APIClient # Set the PICTERRA_API_KEY environment variable to define your API key client = APIClient() # The Id of a folder/project you own folder_id = "7ec40c11-f181-436a-9d33-d7b3f63e0e0f" local_raster_id = client.upload_raster('data/raster1.tif', name='A nice raster') print('Uploaded local raster=', local_raster_id) for raster in client.list_rasters(): pprint('raster %s' % "\n".join(["%s=%s" % item for item in raster.items()])) wms_raster_id = client.upload_remote_raster( 'wms', 'http://wms.zh.ch/OrthoZHWMS?LAYERS=OrthoZHWMS', 0.3, footprint={ "type": "Polygon", "coordinates": [[[8.531441688537598, 47.3669375756445], [8.555259704589844, 47.3669375756445], [8.555259704589844, 47.37530808909385], [8.531441688537598, 47.37530808909385], [8.531441688537598, 47.3669375756445]]]