PermafrostDiscoveryGateway / viz-staging

PDG Visualization staging pipeline
Apache License 2.0
2 stars 1 forks source link

Add method that crops input vector file by footprint #6

Closed robyngit closed 1 year ago

robyngit commented 1 year ago

The IWP footprint boundaries don't align perfectly with the input data. For example:

WV02_20190909214803_103001009823E100_19SEP09214803-M1BS-503663179070_01_P003

This results in bright artifacts in the resulting raster layer where the input data spills over the boundaries:

screen-shot-cesium

To resolve this, we decided in our PDG meeting today that the input vector file should be cropped using the footprint boundary. A polygon is considered inside the boundary if 1) its centroid is within the footprint boundary OR 2) the polygon is completely within the boundary. (Can test both and see which gives better results).

This issue encompasses adding this clipping step as an (optional/configurable) part of the footprints-deduplication method.

robyngit commented 1 year ago

There is now a clip_to_footprint option for the workflow. Setting it to true for the IWP layer removes the problem spots that we were seeing before.

Before

Screen Shot 2022-06-02 at 08 48 10

After

Screen Shot 2022-06-02 at 08 48 47

In this example, a polygon is kept if its boundary and interior intersect with the interior of the footprint (but not its boundary or exterior). This setting is called within and is the default behaviour of the clip_by_footprint method, but any predicate that can be used in the geopanda's sjoin method can be set (See shapely binary-predicates)