Skip to content

Commit

Permalink
do not output GEOMETRYCOLLECTION geometry for relations which are are…
Browse files Browse the repository at this point in the history
…as (#65)
  • Loading branch information
patrickbr authored Jan 12, 2024
1 parent 13599c6 commit 42eb3f4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/osm2rdf/osm/Relation.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Relation {
const noexcept;
[[nodiscard]] const osm2rdf::osm::TagList& tags() const noexcept;
[[nodiscard]] bool hasCompleteGeometry() const noexcept;
[[nodiscard]] bool isArea() const noexcept;
#if BOOST_VERSION >= 107800
[[nodiscard]] bool hasGeometry() const noexcept;
[[nodiscard]] const osm2rdf::geometry::Box& envelope() const noexcept;
Expand Down
2 changes: 1 addition & 1 deletion src/osm/FactHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void osm2rdf::osm::FactHandler<W>::relation(
}

#if BOOST_VERSION >= 107800
if (relation.hasGeometry()) {
if (relation.hasGeometry() && !relation.isArea()) {
if (!_config.hasGeometryAsWkt) {
const std::string& geomObj = _writer->generateIRI(
NAMESPACE__OSM2RDF_GEOM, "relation_" + std::to_string(relation.id()));
Expand Down
9 changes: 9 additions & 0 deletions src/osm/Relation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ const osm2rdf::osm::TagList& osm2rdf::osm::Relation::tags() const noexcept {
return _tags;
}

// ____________________________________________________________________________
bool osm2rdf::osm::Relation::isArea() const noexcept {
const auto& typeTag = _tags.find("type");
if (typeTag != _tags.end()) {
return typeTag->second == "multipolygon" || typeTag->second == "boundary";
}
return false;
}

// ____________________________________________________________________________
const std::vector<osm2rdf::osm::RelationMember>&
osm2rdf::osm::Relation::members() const noexcept {
Expand Down

0 comments on commit 42eb3f4

Please sign in to comment.