Fix: allow loading multiple features with same name in geojson file

This commit is contained in:
Emma Broman
2023-06-08 13:58:37 +02:00
parent 3848edfcc4
commit b211df72a6

View File

@@ -649,8 +649,16 @@ void GeoJsonComponent::parseSingleFeature(const geos::io::GeoJSONFeature& featur
_geometryFeatures.push_back(std::move(g));
std::string name = _geometryFeatures.back().key();
std::string identifier = makeIdentifier(name);
// If there is already an owner with that name as an identifier, make a
// unique one
if (_featuresPropertyOwner.hasPropertySubOwner(identifier)) {
identifier = fmt::format("Feature{}-", index, identifier);
}
properties::PropertyOwner::PropertyOwnerInfo info = {
makeIdentifier(name),
identifier,
name
// @TODO: Use description from file, if any
};