Analytics Feeds

This notebook maintains a list of analytics feeds used in this repository.


In [1]:
subscriptions = [
    {
        'id': '9db92275-1d89-4d3b-a0b6-68abd2e94142',
        'used_by': ['analytics/02_fetching_feed_results']
    },
    {
        'id': 'cda3398b-1283-4ad9-87a6-e25796b5ca80',
        'used_by': ['analytics/03_visualizing_raster_results']
    },
    {
        'id': '02c4f912-090f-45aa-a18b-ac4a55e4b9ba',
        'used_by': ['analytics-snippets/building_footprints_as_vector']
    },
    {
        'id': 'f184516c-b948-406f-b257-deaa66c3f38a',
        'used_by': ['analytics-snippets/roads_as_vector']
    },
]

Get feeds from subscription ids


In [2]:
from pprint import pprint
import os

from planet import api

In [3]:
# if your Planet API Key is not set as an environment variable, you can paste it below
API_KEY = os.environ.get('PL_API_KEY', 'PASTE_YOUR_KEY_HERE')

analytics_client = api.ClientV1(api_key=API_KEY)

In [4]:
def get_sub_info(subscription_id):
    return analytics_client.get_subscription_info(subscription_id).get()

def get_sub_title(subscription_id):
    return get_sub_info(subscription_id)['title']

def get_feed_id(subscription_id):
    return get_sub_info(subscription_id)['feedID']

def get_feed_info(feed_id):
    return analytics_client.get_feed_info(feed_id).get()

def get_feed_title(feed_id):
    return get_feed_info(feed_id)['title']
    

titles = [get_sub_title(s['id']) for s in subscriptions]
print(titles)

feed_ids = [get_feed_id(s['id']) for s in subscriptions]
print(feed_ids)

feed_titles = [get_feed_title(fid) for fid in feed_ids]
print(feed_titles)


['Port of Oakland, USA', 'Hefei, China', 'Sazgin, Turkey', 'Kirazli, Turkey']
['1b4c9ee2-699b-4621-bb4f-934eda8090b5', '36d9d1b0-dcd4-40bc-b411-5eb8e06062a2', 'b442c53b-fc72-4bee-bab4-0b7aa318ccd9', '36d9d1b0-dcd4-40bc-b411-5eb8e06062a2']
['Ship Detections', 'Roads (v7)', 'Buildings (v7)', 'Roads (v7)']