def _update_feature(clip_to_aoi: bool, feature: dict, new_shape) -> dict:
"""
Updates the feature with the new shape, and splittable property
:param clip_to_aoi: value for feature's splittable property
:param feature: feature to be updated
:param new_shape: new shape to use for feature
:return:
"""
if clip_to_aoi:
# update the feature with the clipped shape
if new_shape.geom_type == 'Polygon':
# shapely may return a POLYGON rather than a MULTIPOLYGON if there is just one intersection area
new_shape = MultiPolygon([new_shape])
feature['geometry'] = mapping(new_shape)
feature['properties']['x'] = None
feature['properties']['y'] = None
feature['properties']['zoom'] = None
feature['properties']['splittable'] = False
return feature
评论列表
文章目录