An Introduction to Cloud Optimized GeoTIFFS (COGs) Part 2: Converting Regular GeoTIFFs into COGs

last updated: September 04, 2024

For the purpose of this demonstration, we will place a simple order to the Orders API that will return us some Non Cloud Optimized GeoTIFFs. First, we'll use the Data API to do a quick search of the Planet catalog for PSScene items, filtering by a specific AOI and TOI. We will take the item id's returned from that search to submit a simple order to the Orders API. We'll download an analytic bundle containing the GeoTIFFs, udms, and xml files, focusing our attention on just the GeoTIFFs so we can inspect them and convert them to COGs.

Import Dependencies

In [3]:
import requests
import os
from requests.auth import HTTPBasicAuth
import json
import pathlib
from rio_cogeo.cogeo import cog_translate
from rio_cogeo.profiles import cog_profiles

Authentication

In [4]:
## Get Planet API key stored as an environment variable on your system
PLANET_API_KEY = os.getenv('PLANET_API_KEY')

## HTTP Basic Authentication
planet_auth = HTTPBasicAuth(PLANET_API_KEY, '')
In [5]:
# set content type to json
headers = {'content-type': 'application/json'}

Create a Search with Planet's Data API

In [6]:
# Quick Search endpoint
BASE_URL="https://api.planet.com/data/v1"
quick_search_url = "{}/quick-search".format(BASE_URL)
print(quick_search_url)
https://api.planet.com/data/v1/quick-search
In [7]:
## Search for items that intersect the specified geometry. The AOI is centered around midtown Manhattan
geom_filter = {
    "type": "GeometryFilter",
    "field_name": "geometry",
    "config": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              -73.98674011230469,
              40.7555146258563
            ],
            [
              -73.93670082092285,
              40.7555146258563
            ],
            [
              -73.93670082092285,
              40.80542887583346
            ],
            [
              -73.98674011230469,
              40.80542887583346
            ],
            [
              -73.98674011230469,
              40.7555146258563
            ]
          ]
        ]  
    }
}

# Apply a date range filter for imagery. Return all imagery aquired after May 11th, 2021 and on or before 
# May 17th, 2021
date_range_filter = {
    "type": "DateRangeFilter",
    "field_name": "acquired",
    "config": {
        "gt": "2021-05-11T00:00:00Z",
        "lte": "2021-05-17T00:00:00Z"
    } 
}

#Apply a range filter looking at imagery that has cloud cover less than 20 percent
range_filter ={
    "type": "RangeFilter",
    "field_name": "cloud_cover",
    "config": {
        "lte": 0.2
    }
}

# Filter imagery with an AOI around midtown Manhattan aquired after May 10th, 2021 and on or before May 13th, 2021 
# with less than 20 percent cloud coverage
combined_filters = {
    "type": "AndFilter",
    "config": [geom_filter, date_range_filter, range_filter]
}
In [8]:
print(json.dumps(combined_filters, indent=2))
{
  "type": "AndFilter",
  "config": [
    {
      "type": "GeometryFilter",
      "field_name": "geometry",
      "config": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              -73.98674011230469,
              40.7555146258563
            ],
            [
              -73.93670082092285,
              40.7555146258563
            ],
            [
              -73.93670082092285,
              40.80542887583346
            ],
            [
              -73.98674011230469,
              40.80542887583346
            ],
            [
              -73.98674011230469,
              40.7555146258563
            ]
          ]
        ]
      }
    },
    {
      "type": "DateRangeFilter",
      "field_name": "acquired",
      "config": {
        "gt": "2021-05-11T00:00:00Z",
        "lte": "2021-05-17T00:00:00Z"
      }
    },
    {
      "type": "RangeFilter",
      "field_name": "cloud_cover",
      "config": {
        "lte": 0.2
      }
    }
  ]
}
In [9]:
# Create the request object for PSScene Imagery
search_request_4Band={
    "item_types": ["PSScene"],
    "filter": combined_filters
}
In [10]:
search_result_4Band = \
  requests.post(
    quick_search_url,
    auth=planet_auth,
    json=search_request_4Band)

print(json.dumps(search_result_4Band.json(), indent=1))
{
 "_links": {
  "_first": "https://api.planet.com/data/v1/searches/a6a765f52fcb49e39386f3007fdea4b9/results?_page=eyJwYWdlX3NpemUiOiAyNTAsICJzb3J0X2J5IjogInB1Ymxpc2hlZCIsICJzb3J0X2Rlc2MiOiB0cnVlLCAic29ydF9zdGFydCI6IG51bGwsICJzb3J0X2xhc3RfaWQiOiBudWxsLCAic29ydF9wcmV2IjogZmFsc2UsICJxdWVyeV9wYXJhbXMiOiB7fX0%3D",
  "_next": "https://api.planet.com/data/v1/searches/a6a765f52fcb49e39386f3007fdea4b9/results?_page=eyJwYWdlX3NpemUiOiAyNTAsICJzb3J0X2J5IjogInB1Ymxpc2hlZCIsICJzb3J0X2Rlc2MiOiB0cnVlLCAic29ydF9zdGFydCI6ICIyMDIxLTA1LTEyVDIzOjU5OjMyLjAwMDAwMFoiLCAic29ydF9sYXN0X2lkIjogIjIwMjEwNTEyXzE0NTYzNF83NV8yMjM1IiwgInNvcnRfcHJldiI6IGZhbHNlLCAicXVlcnlfcGFyYW1zIjoge319",
  "_self": "https://api.planet.com/data/v1/searches/a6a765f52fcb49e39386f3007fdea4b9/results?_page=eyJwYWdlX3NpemUiOiAyNTAsICJzb3J0X2J5IjogInB1Ymxpc2hlZCIsICJzb3J0X2Rlc2MiOiB0cnVlLCAic29ydF9zdGFydCI6IG51bGwsICJzb3J0X2xhc3RfaWQiOiBudWxsLCAic29ydF9wcmV2IjogZmFsc2UsICJxdWVyeV9wYXJhbXMiOiB7fX0%3D"
 },
 "features": [
  {
   "_links": {
    "_self": "https://api.planet.com/data/v1/item-types/PSScene/items/20210515_145754_03_245c",
    "assets": "https://api.planet.com/data/v1/item-types/PSScene/items/20210515_145754_03_245c/assets/",
    "thumbnail": "https://tiles.planet.com/data/v1/item-types/PSScene/items/20210515_145754_03_245c/thumb"
   },
   "_permissions": [
    "assets.analytic:download",
    "assets.analytic_dn:download",
    "assets.analytic_dn_xml:download",
    "assets.analytic_sr:download",
    "assets.analytic_xml:download",
    "assets.basic_analytic:download",
    "assets.basic_analytic_dn:download",
    "assets.basic_analytic_dn_nitf:download",
    "assets.basic_analytic_dn_rpc:download",
    "assets.basic_analytic_dn_rpc_nitf:download",
    "assets.basic_analytic_dn_xml:download",
    "assets.basic_analytic_dn_xml_nitf:download",
    "assets.basic_analytic_nitf:download",
    "assets.basic_analytic_rpc:download",
    "assets.basic_analytic_rpc_nitf:download",
    "assets.basic_analytic_xml:download",
    "assets.basic_analytic_xml_nitf:download",
    "assets.basic_udm:download",
    "assets.basic_udm2:download",
    "assets.udm:download",
    "assets.udm2:download"
   ],
   "geometry": {
    "coordinates": [
     [
      [
       -74.37268412366183,
       40.859446283772684
      ],
      [
       -74.42776593697927,
       40.669786898778845
      ],
      [
       -74.0116429878091,
       40.59898584160791
      ],
      [
       -73.95524731926979,
       40.788094482224984
      ],
      [
       -74.37268412366183,
       40.859446283772684
      ]
     ]
    ],
    "type": "Polygon"
   },
   "id": "20210515_145754_03_245c",
   "properties": {
    "acquired": "2021-05-15T14:57:54.037986Z",
    "anomalous_pixels": 0,
    "clear_confidence_percent": 97,
    "clear_percent": 100,
    "cloud_cover": 0,
    "cloud_percent": 0,
    "columns": 13261,
    "epsg_code": 32618,
    "ground_control": true,
    "gsd": 4.1,
    "heavy_haze_percent": 0,
    "instrument": "PSB.SD",
    "item_type": "PSScene",
    "light_haze_percent": 0,
    "origin_x": 548364,
    "origin_y": 4523346,
    "pixel_resolution": 3,
    "provider": "planetscope",
    "published": "2021-05-16T02:53:35Z",
    "publishing_stage": "finalized",
    "quality_category": "standard",
    "rows": 9545,
    "satellite_azimuth": 109.8,
    "satellite_id": "245c",
    "shadow_percent": 0,
    "snow_ice_percent": 0,
    "strip_id": "4481598",
    "sun_azimuth": 122.8,
    "sun_elevation": 57.3,
    "updated": "2021-05-16T10:02:42Z",
    "view_angle": 1,
    "visible_confidence_percent": 75,
    "visible_percent": 100
   },
   "type": "Feature"
  },
  {
   "_links": {
    "_self": "https://api.planet.com/data/v1/item-types/PSScene/items/20210515_145751_73_245c",
    "assets": "https://api.planet.com/data/v1/item-types/PSScene/items/20210515_145751_73_245c/assets/",
    "thumbnail": "https://tiles.planet.com/data/v1/item-types/PSScene/items/20210515_145751_73_245c/thumb"
   },
   "_permissions": [
    "assets.analytic:download",
    "assets.analytic_dn:download",
    "assets.analytic_dn_xml:download",
    "assets.analytic_sr:download",
    "assets.analytic_xml:download",
    "assets.basic_analytic:download",
    "assets.basic_analytic_dn:download",
    "assets.basic_analytic_dn_nitf:download",
    "assets.basic_analytic_dn_rpc:download",
    "assets.basic_analytic_dn_rpc_nitf:download",
    "assets.basic_analytic_dn_xml:download",
    "assets.basic_analytic_dn_xml_nitf:download",
    "assets.basic_analytic_nitf:download",
    "assets.basic_analytic_rpc:download",
    "assets.basic_analytic_rpc_nitf:download",
    "assets.basic_analytic_xml:download",
    "assets.basic_analytic_xml_nitf:download",
    "assets.basic_udm:download",
    "assets.basic_udm2:download",
    "assets.udm:download",
    "assets.udm2:download"
   ],
   "geometry": {
    "coordinates": [
     [
      [
       -74.33131600482537,
       41.00269427575604
      ],
      [
       -74.38662597145866,
       40.81303664055583
      ],
      [
       -73.96954443048755,
       40.74217839692822
      ],
      [
       -73.91294381869535,
       40.93129014515558
      ],
      [
       -74.33131600482537,
       41.00269427575604
      ]
     ]
    ],
    "type": "Polygon"
   },
   "id": "20210515_145751_73_245c",
   "properties": {
    "acquired": "2021-05-15T14:57:51.738548Z",
    "anomalous_pixels": 0,
    "clear_confidence_percent": 99,
    "clear_percent": 100,
    "cloud_cover": 0,
    "cloud_percent": 0,
    "columns": 13263,
    "epsg_code": 32618,
    "ground_control": true,
    "gsd": 4.1,
    "heavy_haze_percent": 0,
    "instrument": "PSB.SD",
    "item_type": "PSScene",
    "light_haze_percent": 0,
    "origin_x": 551730,
    "origin_y": 4539273,
    "pixel_resolution": 3,
    "provider": "planetscope",
    "published": "2021-05-16T02:53:35Z",
    "publishing_stage": "finalized",
    "quality_category": "standard",
    "rows": 9542,
    "satellite_azimuth": 109.8,
    "satellite_id": "245c",
    "shadow_percent": 0,
    "snow_ice_percent": 0,
    "strip_id": "4481598",
    "sun_azimuth": 123.1,
    "sun_elevation": 57.2,
    "updated": "2021-05-16T06:47:52Z",
    "view_angle": 1,
    "visible_confidence_percent": 76,
    "visible_percent": 100
   },
   "type": "Feature"
  },
  {
   "_links": {
    "_self": "https://api.planet.com/data/v1/item-types/PSScene/items/20210514_145807_70_2455",
    "assets": "https://api.planet.com/data/v1/item-types/PSScene/items/20210514_145807_70_2455/assets/",
    "thumbnail": "https://tiles.planet.com/data/v1/item-types/PSScene/items/20210514_145807_70_2455/thumb"
   },
   "_permissions": [
    "assets.analytic:download",
    "assets.analytic_dn:download",
    "assets.analytic_dn_xml:download",
    "assets.analytic_sr:download",
    "assets.analytic_xml:download",
    "assets.basic_analytic:download",
    "assets.basic_analytic_dn:download",
    "assets.basic_analytic_dn_nitf:download",
    "assets.basic_analytic_dn_rpc:download",
    "assets.basic_analytic_dn_rpc_nitf:download",
    "assets.basic_analytic_dn_xml:download",
    "assets.basic_analytic_dn_xml_nitf:download",
    "assets.basic_analytic_nitf:download",
    "assets.basic_analytic_rpc:download",
    "assets.basic_analytic_rpc_nitf:download",
    "assets.basic_analytic_xml:download",
    "assets.basic_analytic_xml_nitf:download",
    "assets.basic_udm:download",
    "assets.basic_udm2:download",
    "assets.udm:download",
    "assets.udm2:download"
   ],
   "geometry": {
    "coordinates": [
     [
      [
       -74.24446662789185,
       40.8059426626398
      ],
      [
       -74.30175541923639,
       40.615109164051304
      ],
      [
       -73.88166825754688,
       40.541004593103835
      ],
      [
       -73.82304346424415,
       40.73219629803683
      ],
      [
       -74.24446662789185,
       40.8059426626398
      ]
     ]
    ],
    "type": "Polygon"
   },
   "id": "20210514_145807_70_2455",
   "properties": {
    "acquired": "2021-05-14T14:58:07.707762Z",
    "anomalous_pixels": 0,
    "clear_confidence_percent": 97,
    "clear_percent": 100,
    "cloud_cover": 0,
    "cloud_percent": 0,
    "columns": 13441,
    "epsg_code": 32618,
    "ground_control": true,
    "gsd": 4.1,
    "heavy_haze_percent": 0,
    "instrument": "PSB.SD",
    "item_type": "PSScene",
    "light_haze_percent": 0,
    "origin_x": 559062,
    "origin_y": 4517490,
    "pixel_resolution": 3,
    "provider": "planetscope",
    "published": "2021-05-15T05:55:18Z",
    "publishing_stage": "finalized",
    "quality_category": "standard",
    "rows": 9695,
    "satellite_azimuth": 277,
    "satellite_id": "2455",
    "shadow_percent": 0,
    "snow_ice_percent": 0,
    "strip_id": "4478204",
    "sun_azimuth": 122.9,
    "sun_elevation": 56.9,
    "updated": "2021-05-15T08:12:01Z",
    "view_angle": 2.9,
    "visible_confidence_percent": 68,
    "visible_percent": 100
   },
   "type": "Feature"
  },
  {
   "_links": {
    "_self": "https://api.planet.com/data/v1/item-types/PSScene/items/20210514_145805_22_2455",
    "assets": "https://api.planet.com/data/v1/item-types/PSScene/items/20210514_145805_22_2455/assets/",
    "thumbnail": "https://tiles.planet.com/data/v1/item-types/PSScene/items/20210514_145805_22_2455/thumb"
   },
   "_permissions": [
    "assets.analytic:download",
    "assets.analytic_dn:download",
    "assets.analytic_dn_xml:download",
    "assets.analytic_sr:download",
    "assets.analytic_xml:download",
    "assets.basic_analytic:download",
    "assets.basic_analytic_dn:download",
    "assets.basic_analytic_dn_nitf:download",
    "assets.basic_analytic_dn_rpc:download",
    "assets.basic_analytic_dn_rpc_nitf:download",
    "assets.basic_analytic_dn_xml:download",
    "assets.basic_analytic_dn_xml_nitf:download",
    "assets.basic_analytic_nitf:download",
    "assets.basic_analytic_rpc:download",
    "assets.basic_analytic_rpc_nitf:download",
    "assets.basic_analytic_xml:download",
    "assets.basic_analytic_xml_nitf:download",
    "assets.basic_udm:download",
    "assets.basic_udm2:download",
    "assets.udm:download",
    "assets.udm2:download"
   ],
   "geometry": {
    "coordinates": [
     [
      [
       -74.19832042788863,
       40.95974534147435
      ],
      [
       -74.25591563689633,
       40.76891583288914
      ],
      [
       -73.83476372219397,
       40.69473031056543
      ],
      [
       -73.77595107651916,
       40.88592501691234
      ],
      [
       -74.19832042788863,
       40.95974534147435
      ]
     ]
    ],
    "type": "Polygon"
   },
   "id": "20210514_145805_22_2455",
   "properties": {
    "acquired": "2021-05-14T14:58:05.229202Z",
    "anomalous_pixels": 0,
    "clear_confidence_percent": 98,
    "clear_percent": 100,
    "cloud_cover": 0,
    "cloud_percent": 0,
    "columns": 13443,
    "epsg_code": 32618,
    "ground_control": true,
    "gsd": 4.1,
    "heavy_haze_percent": 0,
    "instrument": "PSB.SD",
    "item_type": "PSScene",
    "light_haze_percent": 0,
    "origin_x": 562794,
    "origin_y": 4534599,
    "pixel_resolution": 3,
    "provider": "planetscope",
    "published": "2021-05-15T05:55:18Z",
    "publishing_stage": "finalized",
    "quality_category": "standard",
    "rows": 9693,
    "satellite_azimuth": 277.1,
    "satellite_id": "2455",
    "shadow_percent": 0,
    "snow_ice_percent": 0,
    "strip_id": "4478204",
    "sun_azimuth": 123.2,
    "sun_elevation": 56.9,
    "updated": "2021-05-15T08:12:01Z",
    "view_angle": 3,
    "visible_confidence_percent": 69,
    "visible_percent": 100
   },
   "type": "Feature"
  },
  {
   "_links": {
    "_self": "https://api.planet.com/data/v1/item-types/PSScene/items/20210514_154816_78_227b",
    "assets": "https://api.planet.com/data/v1/item-types/PSScene/items/20210514_154816_78_227b/assets/",
    "thumbnail": "https://tiles.planet.com/data/v1/item-types/PSScene/items/20210514_154816_78_227b/thumb"
   },
   "_permissions": [
    "assets.analytic:download",
    "assets.analytic_dn:download",
    "assets.analytic_dn_xml:download",
    "assets.analytic_sr:download",
    "assets.analytic_xml:download",
    "assets.basic_analytic:download",
    "assets.basic_analytic_dn:download",
    "assets.basic_analytic_dn_nitf:download",
    "assets.basic_analytic_dn_rpc:download",
    "assets.basic_analytic_dn_rpc_nitf:download",
    "assets.basic_analytic_dn_xml:download",
    "assets.basic_analytic_dn_xml_nitf:download",
    "assets.basic_analytic_nitf:download",
    "assets.basic_analytic_rpc:download",
    "assets.basic_analytic_rpc_nitf:download",
    "assets.basic_analytic_xml:download",
    "assets.basic_analytic_xml_nitf:download",
    "assets.basic_udm:download",
    "assets.basic_udm2:download",
    "assets.udm:download",
    "assets.udm2:download"
   ],
   "geometry": {
    "coordinates": [
     [
      [
       -74.11165238530299,
       40.88022844171581
      ],
      [
       -74.16965097087387,
       40.688244984254446
      ],
      [
       -73.74516771292764,
       40.612673868851914
      ],
      [
       -73.68540002302983,
       40.80549464933756
      ],
      [
       -74.11165238530299,
       40.88022844171581
      ]
     ]
    ],
    "type": "Polygon"
   },
   "id": "20210514_154816_78_227b",
   "properties": {
    "acquired": "2021-05-14T15:48:16.780257Z",
    "anomalous_pixels": 0,
    "clear_confidence_percent": 96,
    "clear_percent": 100,
    "cloud_cover": 0,
    "cloud_percent": 0,
    "columns": 13575,
    "epsg_code": 32618,
    "ground_control": true,
    "gsd": 4.1,
    "heavy_haze_percent": 0,
    "instrument": "PSB.SD",
    "item_type": "PSScene",
    "light_haze_percent": 0,
    "origin_x": 570162,
    "origin_y": 4525842,
    "pixel_resolution": 3,
    "provider": "planetscope",
    "published": "2021-05-15T04:46:54Z",
    "publishing_stage": "finalized",
    "quality_category": "standard",
    "rows": 9775,
    "satellite_azimuth": 278.5,
    "satellite_id": "227b",
    "shadow_percent": 0,
    "snow_ice_percent": 0,
    "strip_id": "4478803",
    "sun_azimuth": 142.4,
    "sun_elevation": 63.8,
    "updated": "2021-05-15T10:14:08Z",
    "view_angle": 5,
    "visible_confidence_percent": 75,
    "visible_percent": 100
   },
   "type": "Feature"
  },
  {
   "_links": {
    "_self": "https://api.planet.com/data/v1/item-types/PSScene/items/20210513_152348_101f",
    "assets": "https://api.planet.com/data/v1/item-types/PSScene/items/20210513_152348_101f/assets/",
    "thumbnail": "https://tiles.planet.com/data/v1/item-types/PSScene/items/20210513_152348_101f/thumb"
   },
   "_permissions": [
    "assets.analytic:download",
    "assets.analytic_dn:download",
    "assets.analytic_dn_xml:download",
    "assets.analytic_sr:download",
    "assets.analytic_xml:download",
    "assets.basic_analytic:download",
    "assets.basic_analytic_dn:download",
    "assets.basic_analytic_dn_nitf:download",
    "assets.basic_analytic_dn_rpc:download",
    "assets.basic_analytic_dn_rpc_nitf:download",
    "assets.basic_analytic_dn_xml:download",
    "assets.basic_analytic_dn_xml_nitf:download",
    "assets.basic_analytic_nitf:download",
    "assets.basic_analytic_rpc:download",
    "assets.basic_analytic_rpc_nitf:download",
    "assets.basic_analytic_xml:download",
    "assets.basic_analytic_xml_nitf:download",
    "assets.basic_udm:download",
    "assets.basic_udm2:download",
    "assets.udm:download",
    "assets.udm2:download"
   ],
   "geometry": {
    "coordinates": [
     [
      [
       -73.9672324650034,
       40.81564535503385
      ],
      [
       -73.67655740377553,
       40.76608458487274
      ],
      [
       -73.69766539333473,
       40.69454427012009
      ],
      [
       -73.98863012303238,
       40.744440151313285
      ],
      [
       -73.97149039187175,
       40.803480093216486
      ],
      [
       -73.97080263288335,
       40.803362226135754
      ],
      [
       -73.9672324650034,
       40.81564535503385
      ]
     ]
    ],
    "type": "Polygon"
   },
   "id": "20210513_152348_101f",
   "properties": {
    "acquired": "2021-05-13T15:23:48.063258Z",
    "anomalous_pixels": 0.08,
    "clear_confidence_percent": 94,
    "clear_percent": 96,
    "cloud_cover": 0.04,
    "cloud_percent": 2,
    "columns": 8772,
    "epsg_code": 32618,
    "ground_control": true,
    "gsd": 3.8,
    "heavy_haze_percent": 0,
    "instrument": "PS2",
    "item_type": "PSScene",
    "light_haze_percent": 0,
    "origin_x": 585384,
    "origin_y": 4518807,
    "pixel_resolution": 3,
    "provider": "planetscope",
    "published": "2021-05-14T02:53:45Z",
    "publishing_stage": "finalized",
    "quality_category": "standard",
    "rows": 4381,
    "satellite_azimuth": 277.5,
    "satellite_id": "101f",
    "shadow_percent": 2,
    "snow_ice_percent": 0,
    "strip_id": "4475303",
    "sun_azimuth": 132.6,
    "sun_elevation": 60.7,
    "updated": "2021-05-14T06:59:42Z",
    "view_angle": 4,
    "visible_confidence_percent": 76,
    "visible_percent": 98
   },
   "type": "Feature"
  },
  {
   "_links": {
    "_self": "https://api.planet.com/data/v1/item-types/PSScene/items/20210513_152347_101f",
    "assets": "https://api.planet.com/data/v1/item-types/PSScene/items/20210513_152347_101f/assets/",
    "thumbnail": "https://tiles.planet.com/data/v1/item-types/PSScene/items/20210513_152347_101f/thumb"
   },
   "_permissions": [
    "assets.analytic:download",
    "assets.analytic_dn:download",
    "assets.analytic_dn_xml:download",
    "assets.analytic_sr:download",
    "assets.analytic_xml:download",
    "assets.basic_analytic:download",
    "assets.basic_analytic_dn:download",
    "assets.basic_analytic_dn_nitf:download",
    "assets.basic_analytic_dn_rpc:download",
    "assets.basic_analytic_dn_rpc_nitf:download",
    "assets.basic_analytic_dn_xml:download",
    "assets.basic_analytic_dn_xml_nitf:download",
    "assets.basic_analytic_nitf:download",
    "assets.basic_analytic_rpc:download",
    "assets.basic_analytic_rpc_nitf:download",
    "assets.basic_analytic_xml:download",
    "assets.basic_analytic_xml_nitf:download",
    "assets.basic_udm:download",
    "assets.basic_udm2:download",
    "assets.udm:download",
    "assets.udm2:download"
   ],
   "geometry": {
    "coordinates": [
     [
      [
       -73.94812826450752,
       40.878764123248295
      ],
      [
       -73.6572588318352,
       40.82925512193429
      ],
      [
       -73.67849350656874,
       40.757712754345924
      ],
      [
       -73.96957614635204,
       40.80758194147197
      ],
      [
       -73.95238977660173,
       40.866711484404455
      ],
      [
       -73.95165876186178,
       40.86658634858055
      ],
      [
       -73.94812826450752,
       40.878764123248295
      ]
     ]
    ],
    "type": "Polygon"
   },
   "id": "20210513_152347_101f",
   "properties": {
    "acquired": "2021-05-13T15:23:47.058198Z",
    "anomalous_pixels": 0.08,
    "clear_confidence_percent": 95,
    "clear_percent": 95,
    "cloud_cover": 0.03,
    "cloud_percent": 3,
    "columns": 8770,
    "epsg_code": 32618,
    "ground_control": true,
    "gsd": 3.8,
    "heavy_haze_percent": 0,
    "instrument": "PS2",
    "item_type": "PSScene",
    "light_haze_percent": 0,
    "origin_x": 586911,
    "origin_y": 4525833,
    "pixel_resolution": 3,
    "provider": "planetscope",
    "published": "2021-05-14T02:53:45Z",
    "publishing_stage": "finalized",
    "quality_category": "standard",
    "rows": 4378,
    "satellite_azimuth": 277.5,
    "satellite_id": "101f",
    "shadow_percent": 2,
    "snow_ice_percent": 0,
    "strip_id": "4475303",
    "sun_azimuth": 132.7,
    "sun_elevation": 60.6,
    "updated": "2021-05-14T06:59:42Z",
    "view_angle": 4,
    "visible_confidence_percent": 75,
    "visible_percent": 97
   },
   "type": "Feature"
  },
  {
   "_links": {
    "_self": "https://api.planet.com/data/v1/item-types/PSScene/items/20210513_150713_64_1067",
    "assets": "https://api.planet.com/data/v1/item-types/PSScene/items/20210513_150713_64_1067/assets/",
    "thumbnail": "https://tiles.planet.com/data/v1/item-types/PSScene/items/20210513_150713_64_1067/thumb"
   },
   "_permissions": [
    "assets.analytic:download",
    "assets.analytic_dn:download",
    "assets.analytic_dn_xml:download",
    "assets.analytic_sr:download",
    "assets.analytic_xml:download",
    "assets.basic_analytic:download",
    "assets.basic_analytic_dn:download",
    "assets.basic_analytic_dn_nitf:download",
    "assets.basic_analytic_dn_rpc:download",
    "assets.basic_analytic_dn_rpc_nitf:download",
    "assets.basic_analytic_dn_xml:download",
    "assets.basic_analytic_dn_xml_nitf:download",
    "assets.basic_analytic_nitf:download",
    "assets.basic_analytic_rpc:download",
    "assets.basic_analytic_rpc_nitf:download",
    "assets.basic_analytic_xml:download",
    "assets.basic_analytic_xml_nitf:download",
    "assets.basic_udm:download",
    "assets.basic_udm2:download",
    "assets.udm:download",
    "assets.udm2:download"
   ],
   "geometry": {
    "coordinates": [
     [
      [
       -74.24868126954468,
       40.738094335373525
      ],
      [
       -74.20771604517796,
       40.59348951919248
      ],
      [
       -73.92144378585328,
       40.63976411448478
      ],
      [
       -73.96201579685065,
       40.785054430186705
      ],
      [
       -74.24868126954468,
       40.738094335373525
      ]
     ]
    ],
    "type": "Polygon"
   },
   "id": "20210513_150713_64_1067",
   "properties": {
    "acquired": "2021-05-13T15:07:13.643492Z",
    "anomalous_pixels": 0,
    "clear_confidence_percent": 97,
    "clear_percent": 95,
    "cloud_cover": 0,
    "cloud_percent": 4,
    "columns": 9256,
    "epsg_code": 32618,
    "ground_control": true,
    "gsd": 3.7,
    "heavy_haze_percent": 0,
    "instrument": "PS2.SD",
    "item_type": "PSScene",
    "light_haze_percent": 0,
    "origin_x": 563436,
    "origin_y": 4515417,
    "pixel_resolution": 3,
    "provider": "planetscope",
    "published": "2021-05-14T02:47:44Z",
    "publishing_stage": "finalized",
    "quality_category": "standard",
    "rows": 7162,
    "satellite_azimuth": 258.3,
    "satellite_id": "1067",
    "shadow_percent": 1,
    "snow_ice_percent": 0,
    "strip_id": "4475043",
    "sun_azimuth": 126,
    "sun_elevation": 58.1,
    "updated": "2021-05-14T08:59:15Z",
    "view_angle": 4.1,
    "visible_confidence_percent": 85,
    "visible_percent": 96
   },
   "type": "Feature"
  },
  {
   "_links": {
    "_self": "https://api.planet.com/data/v1/item-types/PSScene/items/20210513_150715_17_1067",
    "assets": "https://api.planet.com/data/v1/item-types/PSScene/items/20210513_150715_17_1067/assets/",
    "thumbnail": "https://tiles.planet.com/data/v1/item-types/PSScene/items/20210513_150715_17_1067/thumb"
   },
   "_permissions": [
    "assets.analytic:download",
    "assets.analytic_dn:download",
    "assets.analytic_dn_xml:download",
    "assets.analytic_sr:download",
    "assets.analytic_xml:download",
    "assets.basic_analytic:download",
    "assets.basic_analytic_dn:download",
    "assets.basic_analytic_dn_nitf:download",
    "assets.basic_analytic_dn_rpc:download",
    "assets.basic_analytic_dn_rpc_nitf:download",
    "assets.basic_analytic_dn_xml:download",
    "assets.basic_analytic_dn_xml_nitf:download",
    "assets.basic_analytic_nitf:download",
    "assets.basic_analytic_rpc:download",
    "assets.basic_analytic_rpc_nitf:download",
    "assets.basic_analytic_xml:download",
    "assets.basic_analytic_xml_nitf:download",
    "assets.basic_udm:download",
    "assets.basic_udm2:download",
    "assets.udm:download",
    "assets.udm2:download"
   ],
   "geometry": {
    "coordinates": [
     [
      [
       -74.27631322948251,
       40.834882218188305
      ],
      [
       -74.23519958613848,
       40.6902935056587
      ],
      [
       -73.94853801714905,
       40.73659466447457
      ],
      [
       -73.98913398299976,
       40.88191007766607
      ],
      [
       -74.27631322948251,
       40.834882218188305
      ]
     ]
    ],
    "type": "Polygon"
   },
   "id": "20210513_150715_17_1067",
   "properties": {
    "acquired": "2021-05-13T15:07:15.171792Z",
    "anomalous_pixels": 0,
    "clear_confidence_percent": 97,
    "clear_percent": 96,
    "cloud_cover": 0,
    "cloud_percent": 3,
    "columns": 9256,
    "epsg_code": 32618,
    "ground_control": true,
    "gsd": 3.7,
    "heavy_haze_percent": 0,
    "instrument": "PS2.SD",
    "item_type": "PSScene",
    "light_haze_percent": 0,
    "origin_x": 561015,
    "origin_y": 4526142,
    "pixel_resolution": 3,
    "provider": "planetscope",
    "published": "2021-05-14T00:46:59Z",
    "publishing_stage": "finalized",
    "quality_category": "standard",
    "rows": 7162,
    "satellite_azimuth": 258.4,
    "satellite_id": "1067",
    "shadow_percent": 2,
    "snow_ice_percent": 0,
    "strip_id": "4475043",
    "sun_azimuth": 126.1,
    "sun_elevation": 58.1,
    "updated": "2021-05-14T06:54:57Z",
    "view_angle": 4.1,
    "visible_confidence_percent": 86,
    "visible_percent": 97
   },
   "type": "Feature"
  },
  {
   "_links": {
    "_self": "https://api.planet.com/data/v1/item-types/PSScene/items/20210512_152647_0f15",
    "assets": "https://api.planet.com/data/v1/item-types/PSScene/items/20210512_152647_0f15/assets/",
    "thumbnail": "https://tiles.planet.com/data/v1/item-types/PSScene/items/20210512_152647_0f15/thumb"
   },
   "_permissions": [
    "assets.analytic:download",
    "assets.analytic_dn:download",
    "assets.analytic_dn_xml:download",
    "assets.analytic_sr:download",
    "assets.analytic_xml:download",
    "assets.basic_analytic:download",
    "assets.basic_analytic_dn:download",
    "assets.basic_analytic_dn_nitf:download",
    "assets.basic_analytic_dn_rpc:download",
    "assets.basic_analytic_dn_rpc_nitf:download",
    "assets.basic_analytic_dn_xml:download",
    "assets.basic_analytic_dn_xml_nitf:download",
    "assets.basic_analytic_nitf:download",
    "assets.basic_analytic_rpc:download",
    "assets.basic_analytic_rpc_nitf:download",
    "assets.basic_analytic_xml:download",
    "assets.basic_analytic_xml_nitf:download",
    "assets.basic_udm:download",
    "assets.basic_udm2:download",
    "assets.udm:download",
    "assets.udm2:download"
   ],
   "geometry": {
    "coordinates": [
     [
      [
       -73.99031432008931,
       40.71563074078843
      ],
      [
       -74.28470047757162,
       40.76572808145461
      ],
      [
       -74.26330870557332,
       40.83794830174201
      ],
      [
       -73.96909651736247,
       40.78806000415319
      ],
      [
       -73.97325723237714,
       40.77427147969483
      ],
      [
       -73.97270260764692,
       40.77417710815058
      ],
      [
       -73.99031432008931,
       40.71563074078843
      ]
     ]
    ],
    "type": "Polygon"
   },
   "id": "20210512_152647_0f15",
   "properties": {
    "acquired": "2021-05-12T15:26:47.88976Z",
    "anomalous_pixels": 0.04,
    "clear_confidence_percent": 97,
    "clear_percent": 99,
    "cloud_cover": 0.02,
    "cloud_percent": 0,
    "columns": 8870,
    "epsg_code": 32618,
    "ground_control": true,
    "gsd": 3.9,
    "heavy_haze_percent": 0,
    "instrument": "PS2",
    "item_type": "PSScene",
    "light_haze_percent": 0,
    "origin_x": 560370,
    "origin_y": 4521030,
    "pixel_resolution": 3,
    "provider": "planetscope",
    "published": "2021-05-13T03:52:53Z",
    "publishing_stage": "finalized",
    "quality_category": "standard",
    "rows": 4450,
    "satellite_azimuth": 275.2,
    "satellite_id": "0f15",
    "shadow_percent": 0,
    "snow_ice_percent": 1,
    "strip_id": "4471821",
    "sun_azimuth": 133.9,
    "sun_elevation": 60.8,
    "updated": "2021-05-13T10:05:35Z",
    "view_angle": 2,
    "visible_confidence_percent": 83,
    "visible_percent": 100
   },
   "type": "Feature"
  },
  {
   "_links": {
    "_self": "https://api.planet.com/data/v1/item-types/PSScene/items/20210512_152646_0f15",
    "assets": "https://api.planet.com/data/v1/item-types/PSScene/items/20210512_152646_0f15/assets/",
    "thumbnail": "https://tiles.planet.com/data/v1/item-types/PSScene/items/20210512_152646_0f15/thumb"
   },
   "_permissions": [
    "assets.analytic:download",
    "assets.analytic_dn:download",
    "assets.analytic_dn_xml:download",
    "assets.analytic_sr:download",
    "assets.analytic_xml:download",
    "assets.basic_analytic:download",
    "assets.basic_analytic_dn:download",
    "assets.basic_analytic_dn_nitf:download",
    "assets.basic_analytic_dn_rpc:download",
    "assets.basic_analytic_dn_rpc_nitf:download",
    "assets.basic_analytic_dn_xml:download",
    "assets.basic_analytic_dn_xml_nitf:download",
    "assets.basic_analytic_nitf:download",
    "assets.basic_analytic_rpc:download",
    "assets.basic_analytic_rpc_nitf:download",
    "assets.basic_analytic_xml:download",
    "assets.basic_analytic_xml_nitf:download",
    "assets.basic_udm:download",
    "assets.basic_udm2:download",
    "assets.udm:download",
    "assets.udm2:download"
   ],
   "geometry": {
    "coordinates": [
     [
      [
       -73.97180216210324,
       40.77909355282157
      ],
      [
       -74.2664028997079,
       40.82920836979391
      ],
      [
       -74.24494457232056,
       40.9014498359252
      ],
      [
       -73.95041760834685,
       40.8515053377512
      ],
      [
       -73.95462404176209,
       40.837566369819605
      ],
      [
       -73.95418063640875,
       40.83749092855522
      ],
      [
       -73.97180216210324,
       40.77909355282157
      ]
     ]
    ],
    "type": "Polygon"
   },
   "id": "20210512_152646_0f15",
   "properties": {
    "acquired": "2021-05-12T15:26:46.883127Z",
    "anomalous_pixels": 0.03,
    "clear_confidence_percent": 97,
    "clear_percent": 99,
    "cloud_cover": 0.01,
    "cloud_percent": 0,
    "columns": 8872,
    "epsg_code": 32618,
    "ground_control": true,
    "gsd": 3.9,
    "heavy_haze_percent": 0,
    "instrument": "PS2",
    "item_type": "PSScene",
    "light_haze_percent": 0,
    "origin_x": 561855,
    "origin_y": 4528092,
    "pixel_resolution": 3,
    "provider": "planetscope",
    "published": "2021-05-13T03:52:53Z",
    "publishing_stage": "finalized",
    "quality_category": "standard",
    "rows": 4450,
    "satellite_azimuth": 275.2,
    "satellite_id": "0f15",
    "shadow_percent": 0,
    "snow_ice_percent": 1,
    "strip_id": "4471821",
    "sun_azimuth": 134,
    "sun_elevation": 60.8,
    "updated": "2021-05-13T10:02:56Z",
    "view_angle": 2,
    "visible_confidence_percent": 84,
    "visible_percent": 100
   },
   "type": "Feature"
  },
  {
   "_links": {
    "_self": "https://api.planet.com/data/v1/item-types/PSScene/items/20210512_152222_1014",
    "assets": "https://api.planet.com/data/v1/item-types/PSScene/items/20210512_152222_1014/assets/",
    "thumbnail": "https://tiles.planet.com/data/v1/item-types/PSScene/items/20210512_152222_1014/thumb"
   },
   "_permissions": [
    "assets.analytic:download",
    "assets.analytic_dn:download",
    "assets.analytic_dn_xml:download",
    "assets.analytic_sr:download",
    "assets.analytic_xml:download",
    "assets.basic_analytic:download",
    "assets.basic_analytic_dn:download",
    "assets.basic_analytic_dn_nitf:download",
    "assets.basic_analytic_dn_rpc:download",
    "assets.basic_analytic_dn_rpc_nitf:download",
    "assets.basic_analytic_dn_xml:download",
    "assets.basic_analytic_dn_xml_nitf:download",
    "assets.basic_analytic_nitf:download",
    "assets.basic_analytic_rpc:download",
    "assets.basic_analytic_rpc_nitf:download",
    "assets.basic_analytic_xml:download",
    "assets.basic_analytic_xml_nitf:download",
    "assets.basic_udm:download",
    "assets.basic_udm2:download",
    "assets.udm:download",
    "assets.udm2:download"
   ],
   "geometry": {
    "coordinates": [
     [
      [
       -74.26377944125522,
       40.78881729693007
      ],
      [
       -74.26223488612236,
       40.79419481984668
      ],
      [
       -74.26182616840805,
       40.794127621628235
      ],
      [
       -74.25812651031767,
       40.80743674430642
      ],
      [
       -73.9650773180917,
       40.75902034579338
      ],
      [
       -73.9832184062908,
       40.694830255120195
      ],
      [
       -73.9854670243336,
       40.68708009397012
      ],
      [
       -74.27872461673279,
       40.73534199669171
      ],
      [
       -74.26377944125522,
       40.78881729693007
      ]
     ]
    ],
    "type": "Polygon"
   },
   "id": "20210512_152222_1014",
   "properties": {
    "acquired": "2021-05-12T15:22:22.564228Z",
    "anomalous_pixels": 0,
    "clear_confidence_percent": 97,
    "clear_percent": 100,
    "cloud_cover": 0.02,
    "cloud_percent": 0,
    "columns": 8819,
    "epsg_code": 32618,
    "ground_control": true,
    "gsd": 3.8,
    "heavy_haze_percent": 0,
    "instrument": "PS2",
    "item_type": "PSScene",
    "light_haze_percent": 0,
    "origin_x": 560901,
    "origin_y": 4517646,
    "pixel_resolution": 3,
    "provider": "planetscope",
    "published": "2021-05-13T03:45:31Z",
    "publishing_stage": "finalized",
    "quality_category": "standard",
    "rows": 4377,
    "satellite_azimuth": 102.5,
    "satellite_id": "1014",
    "shadow_percent": 0,
    "snow_ice_percent": 0,
    "strip_id": "4472149",
    "sun_azimuth": 132.8,
    "sun_elevation": 60.6,
    "updated": "2021-05-13T09:53:59Z",
    "view_angle": 3,
    "visible_confidence_percent": 77,
    "visible_percent": 100
   },
   "type": "Feature"
  },
  {
   "_links": {
    "_self": "https://api.planet.com/data/v1/item-types/PSScene/items/20210512_152221_1014",
    "assets": "https://api.planet.com/data/v1/item-types/PSScene/items/20210512_152221_1014/assets/",
    "thumbnail": "https://tiles.planet.com/data/v1/item-types/PSScene/items/20210512_152221_1014/thumb"
   },
   "_permissions": [
    "assets.analytic:download",
    "assets.analytic_dn:download",
    "assets.analytic_dn_xml:download",
    "assets.analytic_sr:download",
    "assets.analytic_xml:download",
    "assets.basic_analytic:download",
    "assets.basic_analytic_dn:download",
    "assets.basic_analytic_dn_nitf:download",
    "assets.basic_analytic_dn_rpc:download",
    "assets.basic_analytic_dn_rpc_nitf:download",
    "assets.basic_analytic_dn_xml:download",
    "assets.basic_analytic_dn_xml_nitf:download",
    "assets.basic_analytic_nitf:download",
    "assets.basic_analytic_rpc:download",
    "assets.basic_analytic_rpc_nitf:download",
    "assets.basic_analytic_xml:download",
    "assets.basic_analytic_xml_nitf:download",
    "assets.basic_udm:download",
    "assets.basic_udm2:download",
    "assets.udm:download",
    "assets.udm2:download"
   ],
   "geometry": {
    "coordinates": [
     [
      [
       -74.24642450408183,
       40.84954759450063
      ],
      [
       -74.24422493235842,
       40.857209447972046
      ],
      [
       -74.2439205716801,
       40.85715947303992
      ],
      [
       -74.24021864656655,
       40.87052161618214
      ],
      [
       -73.94680155826984,
       40.822092047902586
      ],
      [
       -73.96539574753778,
       40.75641215980805
      ],
      [
       -73.96721598053044,
       40.7501503494916
      ],
      [
       -74.26063715285925,
       40.79839904931422
      ],
      [
       -74.24642450408183,
       40.84954759450063
      ]
     ]
    ],
    "type": "Polygon"
   },
   "id": "20210512_152221_1014",
   "properties": {
    "acquired": "2021-05-12T15:22:21.558644Z",
    "anomalous_pixels": 0,
    "clear_confidence_percent": 97,
    "clear_percent": 100,
    "cloud_cover": 0.01,
    "cloud_percent": 0,
    "columns": 8816,
    "epsg_code": 32618,
    "ground_control": true,
    "gsd": 3.8,
    "heavy_haze_percent": 0,
    "instrument": "PS2",
    "item_type": "PSScene",
    "light_haze_percent": 0,
    "origin_x": 562368,
    "origin_y": 4524663,
    "pixel_resolution": 3,
    "provider": "planetscope",
    "published": "2021-05-13T03:45:31Z",
    "publishing_stage": "finalized",
    "quality_category": "standard",
    "rows": 4377,
    "satellite_azimuth": 102.6,
    "satellite_id": "1014",
    "shadow_percent": 0,
    "snow_ice_percent": 0,
    "strip_id": "4472149",
    "sun_azimuth": 132.9,
    "sun_elevation": 60.5,
    "updated": "2021-05-13T09:53:59Z",
    "view_angle": 3,
    "visible_confidence_percent": 83,
    "visible_percent": 100
   },
   "type": "Feature"
  },
  {
   "_links": {
    "_self": "https://api.planet.com/data/v1/item-types/PSScene/items/20210512_145636_96_2235",
    "assets": "https://api.planet.com/data/v1/item-types/PSScene/items/20210512_145636_96_2235/assets/",
    "thumbnail": "https://tiles.planet.com/data/v1/item-types/PSScene/items/20210512_145636_96_2235/thumb"
   },
   "_permissions": [
    "assets.analytic:download",
    "assets.analytic_dn:download",
    "assets.analytic_dn_xml:download",
    "assets.analytic_sr:download",
    "assets.analytic_xml:download",
    "assets.basic_analytic:download",
    "assets.basic_analytic_dn:download",
    "assets.basic_analytic_dn_nitf:download",
    "assets.basic_analytic_dn_rpc:download",
    "assets.basic_analytic_dn_rpc_nitf:download",
    "assets.basic_analytic_dn_xml:download",
    "assets.basic_analytic_dn_xml_nitf:download",
    "assets.basic_analytic_nitf:download",
    "assets.basic_analytic_rpc:download",
    "assets.basic_analytic_rpc_nitf:download",
    "assets.basic_analytic_xml:download",
    "assets.basic_analytic_xml_nitf:download",
    "assets.basic_udm:download",
    "assets.basic_udm2:download",
    "assets.udm:download",
    "assets.udm2:download"
   ],
   "geometry": {
    "coordinates": [
     [
      [
       -73.96312166532697,
       40.830271317535875
      ],
      [
       -74.01369495117122,
       40.65484329783307
      ],
      [
       -73.62890814829333,
       40.589951153223076
      ],
      [
       -73.57724701927319,
       40.76487012699357
      ],
      [
       -73.96312166532697,
       40.830271317535875
      ]
     ]
    ],
    "type": "Polygon"
   },
   "id": "20210512_145636_96_2235",
   "properties": {
    "acquired": "2021-05-12T14:56:36.963261Z",
    "anomalous_pixels": 0,
    "clear_confidence_percent": 90,
    "clear_percent": 99,
    "cloud_cover": 0,
    "cloud_percent": 0,
    "columns": 12234,
    "epsg_code": 32618,
    "ground_control": true,
    "gsd": 3.8,
    "heavy_haze_percent": 0,
    "instrument": "PSB.SD",
    "item_type": "PSScene",
    "light_haze_percent": 0,
    "origin_x": 583380,
    "origin_y": 4520436,
    "pixel_resolution": 3,
    "provider": "planetscope",
    "published": "2021-05-12T23:59:32Z",
    "publishing_stage": "finalized",
    "quality_category": "test",
    "rows": 8765,
    "satellite_azimuth": 182.3,
    "satellite_id": "2235",
    "shadow_percent": 0,
    "snow_ice_percent": 1,
    "strip_id": "4471165",
    "sun_azimuth": 123.7,
    "sun_elevation": 56.7,
    "updated": "2021-05-13T04:07:19Z",
    "view_angle": 0.1,
    "visible_confidence_percent": 72,
    "visible_percent": 100
   },
   "type": "Feature"
  },
  {
   "_links": {
    "_self": "https://api.planet.com/data/v1/item-types/PSScene/items/20210512_145634_75_2235",
    "assets": "https://api.planet.com/data/v1/item-types/PSScene/items/20210512_145634_75_2235/assets/",
    "thumbnail": "https://tiles.planet.com/data/v1/item-types/PSScene/items/20210512_145634_75_2235/thumb"
   },
   "_permissions": [
    "assets.analytic:download",
    "assets.analytic_dn:download",
    "assets.analytic_dn_xml:download",
    "assets.analytic_sr:download",
    "assets.analytic_xml:download",
    "assets.basic_analytic:download",
    "assets.basic_analytic_dn:download",
    "assets.basic_analytic_dn_nitf:download",
    "assets.basic_analytic_dn_rpc:download",
    "assets.basic_analytic_dn_rpc_nitf:download",
    "assets.basic_analytic_dn_xml:download",
    "assets.basic_analytic_dn_xml_nitf:download",
    "assets.basic_analytic_nitf:download",
    "assets.basic_analytic_rpc:download",
    "assets.basic_analytic_rpc_nitf:download",
    "assets.basic_analytic_xml:download",
    "assets.basic_analytic_xml_nitf:download",
    "assets.basic_udm:download",
    "assets.basic_udm2:download",
    "assets.udm:download",
    "assets.udm2:download"
   ],
   "geometry": {
    "coordinates": [
     [
      [
       -73.92236344663175,
       40.96908603516853
      ],
      [
       -73.97315169812276,
       40.79371037759496
      ],
      [
       -73.58757474423084,
       40.728758751865044
      ],
      [
       -73.53570650228487,
       40.903663685448315
      ],
      [
       -73.92236344663175,
       40.96908603516853
      ]
     ]
    ],
    "type": "Polygon"
   },
   "id": "20210512_145634_75_2235",
   "properties": {
    "acquired": "2021-05-12T14:56:34.752349Z",
    "anomalous_pixels": 0,
    "clear_confidence_percent": 97,
    "clear_percent": 100,
    "cloud_cover": 0,
    "cloud_percent": 0,
    "columns": 12235,
    "epsg_code": 32618,
    "ground_control": true,
    "gsd": 3.8,
    "heavy_haze_percent": 0,
    "instrument": "PSB.SD",
    "item_type": "PSScene",
    "light_haze_percent": 0,
    "origin_x": 586626,
    "origin_y": 4535886,
    "pixel_resolution": 3,
    "provider": "planetscope",
    "published": "2021-05-12T23:59:32Z",
    "publishing_stage": "finalized",
    "quality_category": "test",
    "rows": 8760,
    "satellite_azimuth": 183.1,
    "satellite_id": "2235",
    "shadow_percent": 0,
    "snow_ice_percent": 0,
    "strip_id": "4471165",
    "sun_azimuth": 124,
    "sun_elevation": 56.7,
    "updated": "2021-05-13T04:26:53Z",
    "view_angle": 0.1,
    "visible_confidence_percent": 76,
    "visible_percent": 100
   },
   "type": "Feature"
  }
 ],
 "type": "FeatureCollection"
}

Submit an Order with the Planet Orders API

In [14]:
# Item id's for PSScene Imagery obtained from our search. We can now use these item id's in 
# preparing our order
item_selection = [feature['id'] for feature in search_result_4Band.json()['features']]
item_selection
Out[14]:
['20210515_145754_03_245c',
 '20210515_145751_73_245c',
 '20210514_145807_70_2455',
 '20210514_145805_22_2455',
 '20210514_154816_78_227b',
 '20210513_152348_101f',
 '20210513_152347_101f',
 '20210513_150713_64_1067',
 '20210513_150715_17_1067',
 '20210512_152647_0f15',
 '20210512_152646_0f15',
 '20210512_152222_1014',
 '20210512_152221_1014',
 '20210512_145636_96_2235',
 '20210512_145634_75_2235']
In [13]:
# Base Order URL
planet_orders_url = 'https://api.planet.com/compute/ops/orders/v2'
In [15]:
# Prepare a simple order
def prepare_simple_order(order_name, item_list, item_type, bundle_selection):
    order_request = {  
       "name":order_name,
       "products":[
          {  
             "item_ids": item_list,
             "item_type":item_type,
             "product_bundle":bundle_selection
          }
       ]
    }
    return order_request
In [16]:
def submit_simple_order(order_name, order_items, base_order_url, auth, item_type, bundle_selection):
    
    # Prepare the order request
    order_request = prepare_simple_order(order_name, order_items, item_type, bundle_selection)
    print(json.dumps(order_request, indent=2))
    
    # Place the order
    order_response = requests.post(base_order_url, json.dumps(order_request), auth=auth, headers=headers)
    print(order_response)
    return order_response
In [ ]:
order_response = submit_simple_order("analytic_order", item_selection, planet_orders_url , planet_auth, "PSScene", "analytic")
In [ ]:
# Append current order id to the base orders URL. Replace with your own order id
current_order_url = planet_orders_url + '/' + 'cb363b75-b4e4-46f1-8d32-0ef87afb6215'
In [ ]:
order_response = requests.get(current_order_url, auth=planet_auth)
In [ ]:
order_results =order_response.json()["_links"]["results"]
order_results

Conversion to COGs

In [17]:
# Create a directory to store the regular geotiffs from our order results
def download_geotiffs(order_results, directory_name):
  
    # Create a directory to store regular geotiffs inside your current working directory
    regular_geotiff_folder = pathlib.Path.cwd() / directory_name
    try:
        regular_geotiff_folder.mkdir(parents=True, exist_ok=False)
        print("Directory to store regular geotiffs has been made")
    except FileExistsError:
        print("Directory to store regular geotiffs already exists")
   
    # get all the analytic image result names
    order_names = [order['name'] for order in order_results if order['name'].endswith('AnalyticMS.tif')]
    
    
    # get the locations for the analytic images
    order_locations = [order['location'] for order in order_results if order['name'].endswith('AnalyticMS.tif')]
    for order_name, order_location in zip(order_names, order_locations):
        geotiff_file_path = pathlib.Path.joinpath(regular_geotiff_folder).joinpath(order_name)
        geotiff_file_path.parent.mkdir(parents=True, exist_ok=True)
        geotiff_download = requests.get(order_location, allow_redirects=True)
        open(geotiff_file_path, 'wb').write(geotiff_download.content)
In [18]:
# Create another directory to store COGs after conversion
def cog_convert(geotiff_directory, order_id, cog_directory_name, item_type):
  
    cog_path = pathlib.Path.cwd() / cog_directory_name
    try:
        cog_path.mkdir(parents=True, exist_ok=False)
        print("Directory to store newly created cogs has been made")
    except FileExistsError:
        print("Directory to store newly created cogs already exists")
    
    geotiff_file_path = pathlib.Path.cwd() / geotiff_directory / order_id / item_type 

    for filename in os.listdir(geotiff_file_path):
        src_path = pathlib.Path.joinpath(geotiff_file_path).joinpath(filename)
        dst_path = pathlib.Path.joinpath(cog_path).joinpath(filename) 
        cog_translate(src_path, dst_path, cog_profiles.get("deflate"))
In [19]:
def cog_conversion_from_order(planet_orders_url, order_id, item_type, planet_auth, original_tiff_path, cog_path):
    
    # Get the user's current order id and append to the base order URL
    current_order_url = planet_orders_url + '/' + order_id
    
    # Get array of results from the current order 
    order_response = requests.get(current_order_url, auth=planet_auth).json()
    order_results = order_response["_links"]["results"]
    
    # From the order results, download our GeoTIFFs and store in directory
    download_geotiffs(order_results, original_tiff_path)
    
    # Convert this directory of GeoTIFFs to COGs and store in separate directory
    cog_convert(original_tiff_path, order_id, cog_path, item_type)
    
In [ ]:
cog_conversion_from_order(planet_orders_url, "edc43923-3ecd-4ee4-932a-e19360522af9", "PSScene", planet_auth, "geotiff",  "cog")

Inspecting and Converting GeoTIFFs and COGs Using rio-cogeo

rio-cogeo is a rasterio plugin for the creation and validation of COGs. It is a pretty neat tool! It has both a CLI and an API to work with. Below we will use the command line to take one of our non cloud optimzed GeoTIFFs from our submitted order and learn more about the details of the format. We can then use the plugin to convert it into a COG and inspect the data and compare the differences.

For the GeoTIFF below, we can see that it is internally tiled and has multiple overviews. However, its offset values for the IFD of the main image as well as the first overview illustrate that the internal structure of the GeoTIFF is not stored as contigious blocks as highlighted in the diagram earlier in this tutorial. Therefore, it is not a valid COG.

Ordinary GeoTIFF

command: rio cogeo info

geotiff_info.png

COG

command: rio cogeo create

Now, let's go look at the converted COG version of this GeoTIFF from our Cogs directory that we created. We can now see that the IFDs and the image data are stored contigously making it a valid COG.

cog.png


Converting GeoTIFFs and COGs Using GDAL

The GDAL command line interface can also be used to quickly create a COG. You need to specify the form of compression used(LZW or Deflate) and also require internal tiling to be present.

translate.png

To create a set of overviews, you can use the gdaladdo command. This command would need to be executed before gdal_translate to create a valid COG.

gdal.png


Up Next

In the next tutorial, we will provide an introduction to Google Cloud and Dynamic Web Tiling with COGs!