Skip to content

Simplify subscription clip rules in the Subscriptions API SDK #1162

@asonnenschein

Description

@asonnenschein

Problem:
In the HTTP Subscriptions API service contract, there is one place to specify the clip tool that covers custom clip and default clip (by omitting aoi and falling back to subscription source geometry).

In the Python SDK, users can specify a custom clip AOI via planet.subscription_request.clip_tool() OR they can fall back on the default clip (subscription source geometry) by defining planet.subscription_request.build_request() kwarg clip_to_source = True. So the default clip behavior is in a separate code path from the custom clip behavior. To add more confusion, if a user defines both clip_tool() and clip_to_source = True then the client will error.

Solution (updated with @wilsaj's feedback):
Keep the clip_to_source kwarg on the build_request() method, and remove the clip_tool() method. Subscriptions API no longer supports custom clip AOIs. Only two clip options are currently supported: clip to subscription source geometry, or don't clip to subscription source geometry. In build_request(), the clip_to_source=True logic can be simplified to appending "tools": [{"type": "clip", "parameters": {}}] to the request rather than copying the subscription source geometry into the tool parameters, and Subscriptions API will automatically clip to the subscription source geometry. The clip_to_source=False logic should be default, and not append any clip tool options to the request.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions