Repository: planetlabs/planet-client-python

Issue:
invalid geometry entry created by planet subscriptions request-catalog
**Expected behavior**

Geometry entry in source.json produced by this command should be just the geometry part of `aoi.geojson`, so `"type": "Polygon"` .

```bash
planet subscriptions request-catalog \
        --item-types PSScene \
        --asset-types ortho_analytic_8b_sr,ortho_udm2 \
        --geometry aoi.geojson \
        --start-time 2022-01-01 > source.json
```
aoi.geojson:
```
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              7.05322265625,
              46.81509864599243
            ],
            [
              7.580566406250001,
              46.81509864599243
            ],
            [
              7.580566406250001,
              47.17477833929903
            ],
            [
              7.05322265625,
              47.17477833929903
            ],
            [
              7.05322265625,
              46.81509864599243
            ]
          ]
        ]
      }
    }
  ]
}
```


**Actual behavior (describe the problem)**
source.json includes the entire featureclass.

source.json:
```
{
  "type": "catalog",
  "parameters": {
    "item_types": [
      "PSScene"
    ],
    "asset_types": [
      "ortho_analytic_8b_sr",
      "ortho_udm2"
    ],
    "geometry": {
      "type": "FeatureCollection",
      "features": [
        {
          "type": "Feature",
          "properties": {},
          "geometry": {
            "type": "Polygon",
            "coordinates": [
              [
                [
                  7.05322265625,
                  46.81509864599243
                ],
                [
                  7.580566406250001,
                  46.81509864599243
                ],
                [
                  7.580566406250001,
                  47.17477833929903
                ],
                [
                  7.05322265625,
                  47.17477833929903
                ],
                [
                  7.05322265625,
                  46.81509864599243
                ]
              ]
            ]
          }
        }
      ]
    },
    "start_time": "2022-01-01T00:00:00Z"
  }
}
```

**Ideas**
This could probably be fixed by applying `geojson.to_geometry()` somewhere in the processing chain.

Comments:

Patch:
diff --git a/planet/subscription_request.py b/planet/subscription_request.py
index 26b761e..212bdc7 100644
--- a/planet/subscription_request.py
+++ b/planet/subscription_request.py
@@ -133,7 +133,7 @@ def catalog_source(
     parameters = {
         "item_types": item_types,
         "asset_types": asset_types,
-        "geometry": geometry,
+        "geometry": geojson.as_geom(geometry),
     }
 
     try:


Test patch:
diff --git a/tests/unit/test_subscription_request.py b/tests/unit/test_subscription_request.py
index 51e7590..7c0bca2 100644
--- a/tests/unit/test_subscription_request.py
+++ b/tests/unit/test_subscription_request.py
@@ -90,6 +90,30 @@ def test_catalog_source_success(geom_geojson):
     assert res == expected
 
 
+def test_catalog_source_featurecollection(featurecollection_geojson,
+                                          geom_geojson):
+    '''geojson specified as featurecollection is simplified down to just
+    the geometry'''
+    res = subscription_request.catalog_source(
+        item_types=["PSScene"],
+        asset_types=["ortho_analytic_4b"],
+        geometry=featurecollection_geojson,
+        start_time=datetime(2021, 3, 1),
+    )
+
+    expected = {
+        "type": "catalog",
+        "parameters": {
+            "geometry": geom_geojson,
+            "start_time": "2021-03-01T00:00:00Z",
+            "item_types": ["PSScene"],
+            "asset_types": ["ortho_analytic_4b"]
+        }
+    }
+
+    assert res == expected
+
+
 def test_catalog_source_invalid_start_time(geom_geojson):
     with pytest.raises(exceptions.ClientError):
         subscription_request.catalog_source(