Skip to content

Commit

Permalink
Make new clip_to_footprint an option in staging
Browse files Browse the repository at this point in the history
- Also make minor changes to the clip_to_footprint deduplication method

Relates to #6
  • Loading branch information
robyngit committed Jun 1, 2022
1 parent c1c18ae commit 7302f64
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions pdgstaging/ConfigManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,21 @@ class ConfigManager():
centroid_tolerance will use the units of this CRS. Set to
None to skip the re-projection and use the CRS of the
GeoDataFrame.
- deduplicate_clip_to_footprint : bool, optional
For the 'footprints' deduplication method only. If True,
then polygons that fall outside the bounds of the
associated footprint will be removed. Default is False.
- deduplicate_clip_method: str, optional
For the 'footprints' deduplication method only, when
deduplicate_clip_to_footprint is True. The method to use to
determine if a polygon falls within the footprint. The
method is used as the the predicate for an sjoin operation
between the polygons GDF and the footprint GDF. Can be one
of: 'contains', 'contains_properly', 'covers', 'crosses',
'intersects', 'overlaps', 'touches', 'within' (any option
listed by
geopandas.GeoDataFrame.sindex.valid_query_predicates).
Defaults to 'within'.
Example config:
---------------
Expand Down Expand Up @@ -293,7 +308,7 @@ class ConfigManager():
"palette": ["red", "blue"],
"z_config": {
0: {
"val_range": [0,0.5],
"val_range": [0,0.5],
}, ...
}
}
Expand Down Expand Up @@ -360,7 +375,9 @@ class ConfigManager():
'deduplicate_overlap_tolerance': 0.5,
'deduplicate_overlap_both': True,
'deduplicate_centroid_tolerance': None,
'deduplicate_distance_crs': 'EPSG:3857'
'deduplicate_distance_crs': 'EPSG:3857',
'deduplicate_clip_to_footprint': False,
'deduplicate_clip_method': 'within'
}

def __init__(self, config=None):
Expand Down Expand Up @@ -960,7 +977,11 @@ def get_deduplication_config(self, gdf=None):
return {
'split_by': file_prop,
'footprints': footprints,
'keep_rules': self.get('deduplicate_keep_rules')
'keep_rules': self.get('deduplicate_keep_rules'),
'clip_to_footprint': self.get(
'deduplicate_clip_to_footprint'),
'clip_method': self.get(
'deduplicate_clip_method')
}

return None
Expand Down

0 comments on commit 7302f64

Please sign in to comment.