Skip to content
This repository was archived by the owner on Dec 10, 2019. It is now read-only.

Commit afa3f6d

Browse files
author
Chris Brown
committed
Add new upload creation for Planet imagery
Allows passing in planet IDs to create uploads
1 parent 2716ea3 commit afa3f6d

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

rasterfoundry/models/upload.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,42 @@ def __init__(self, upload, api):
2929
self.metadata = upload.metadata
3030
self.files = upload.files
3131

32+
@classmethod
33+
def upload_create_from_planet(
34+
cls, datasource, organization, planet_ids,
35+
metadata={}, visibility='PRIVATE', project_id=None
36+
):
37+
"""
38+
Args:
39+
datasource (str): UUID of the datasource this upload belongs to
40+
organization (str): UUID of the organization this upload belongs to
41+
planet_ids (list[str]): list of IDs from Planet to import
42+
metadata (dict): Additional information to store with this upload.
43+
acquisitionDate and cloudCover will be parsed into any created
44+
scenes.
45+
visibility (str): PUBLIC, PRIVATE, or ORGANIZATION visibility level
46+
for the created scenes
47+
project_id (str): UUID of the project scenes from this upload
48+
should be added to
49+
50+
Returns:
51+
dict: splattable object to post to /uploads/
52+
"""
53+
upload_status = 'UPLOADED'
54+
file_type = 'GEOTIFF'
55+
56+
return dict(
57+
uploadStatus=upload_status,
58+
files=planet_ids,
59+
uploadType='PLANET',
60+
fileType=file_type,
61+
datasource=datasource,
62+
organizationId=organization,
63+
metadata=metadata,
64+
visibility=visibility,
65+
projectId=project_id
66+
)
67+
3268
@classmethod
3369
def upload_create_from_files(
3470
cls, datasource, organization, paths_to_tifs,

0 commit comments

Comments
 (0)