Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions mapmaker/flatmap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ def duplicate_feature_id(self, feature_ids: str) -> bool:
#========================================================
return self.__features_with_id.get(feature_ids, None) is not None

def remove_feature_id(self, feature_id: str):
#=============================================
# Free up an id so another feature can be registered with it
self.__features_with_id.pop(feature_id, None)

def feature_to_geojson_ids(self, feature_ids: list[str]) -> list[int]:
#=====================================================================
return [f.geojson_id for id in feature_ids
Expand Down
4 changes: 3 additions & 1 deletion mapmaker/properties/pathways.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,9 @@ def __route_network_connectivity(self, network: Network):
# Add a polygon feature for a nerve cuff
properties = feature.properties.copy()
feature.properties.pop('models', None) # Otherwise we can get two markers on the feature
properties.pop('id', None) # Otherwise we will have a duplicate id...
if (feature_id := feature.properties.pop('id', None)) is not None:
# The polygon, not the dashed outline, should own the feature id
self.__flatmap.remove_feature_id(feature_id)
nerve_polygon_feature = self.__flatmap.new_feature(
'pathways',
shapely.geometry.Polygon(feature.geometry.coords).buffer(0), properties)
Expand Down
Loading