Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.

Commit

Permalink
Fix for saving relation member ref type, remove debug code
Browse files Browse the repository at this point in the history
  • Loading branch information
emi420 committed Apr 24, 2024
1 parent b94ff62 commit 85fb8e7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
18 changes: 3 additions & 15 deletions src/osm/osmchange.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ OsmChangeFile::buildRelationGeometry(osmobjects::OsmRelation &relation) {
if (!waycache.count(mit->ref)) {
// Way is not available in cache,
// possibily because Relation is not in the priority area
// or way was deleted
// or the way was deleted
return;
}

Expand All @@ -200,7 +200,7 @@ OsmChangeFile::buildRelationGeometry(osmobjects::OsmRelation &relation) {
if (!waycache.count(nextWayId)) {
// Way is not available in cache,
// possibily because Relation is not in the priority area
// or way was deleted
// or the way was deleted
return;
}
nextWay = waycache.at(nextWayId);
Expand All @@ -221,17 +221,7 @@ OsmChangeFile::buildRelationGeometry(osmobjects::OsmRelation &relation) {
}
}

// Remove repeated point on line continuation
// if (bg::equals(part.back(), way->linestring.front())) {
// std::cout << "HERE" << std::endl;
// std::stringstream ss;
// ss << std::setprecision(12) << bg::wkt(way->linestring | boost::adaptors::sliced(1, bg::num_points(way->linestring)));
// std::cout << ss.str() << std::endl;

// bg::append(part, way->linestring | boost::adaptors::sliced(1, bg::num_points(way->linestring)));
// } else {
bg::append(part, way->linestring);
// }

// Check if object is closed
if (relation.isMultiPolygon() && bg::equals(part.back(), part.front())) {
Expand Down Expand Up @@ -260,7 +250,7 @@ OsmChangeFile::buildRelationGeometry(osmobjects::OsmRelation &relation) {
if (!waycache.count(nextWayId)) {
// Way is not available in cache,
// possibily because Relation is not in the priority area
// or way was deleted
// or the way was deleted
return;
}
nextWay = waycache.at(nextWayId);
Expand Down Expand Up @@ -421,10 +411,8 @@ OsmChangeFile::buildRelationGeometry(osmobjects::OsmRelation &relation) {
if (geometry.size() > 0) {
geometry.erase(geometry.size() - 1);
if (relation.isMultiPolygon()) {
// std::cout << "POLYGON(" + geometry + ")" << std::endl;
bg::read_wkt("POLYGON(" + geometry + ")", relation.multipolygon);
} else {
// std::cout << "MULTILINESTRING(" + geometry + ")" << std::endl;
bg::read_wkt("MULTILINESTRING(" + geometry + ")", relation.multilinestring);
}
}
Expand Down
13 changes: 10 additions & 3 deletions src/raw/queryraw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,16 @@ buildMembersQuery(std::list<OsmRelationMember> members) {
member_fmt % mit->role;
membersStr += member_fmt.str();
member_fmt % "type";
member_fmt % mit->type;
switch(mit->type) {
case osmobjects::osmtype_t::way:
member_fmt % "way"; break;
case osmobjects::osmtype_t::node:
member_fmt % "node"; break;
case osmobjects::osmtype_t::relation:
member_fmt % "relation"; break;
default:
member_fmt % "";
}
membersStr += member_fmt.str();
membersStr += "\"ref\":";
membersStr += std::to_string(mit->ref);
Expand Down Expand Up @@ -466,8 +475,6 @@ QueryRaw::applyChange(const OsmRelation &relation) const

query += fmt.str();
}
} else {
std::cout << "Relation " << relation.id << " has empty geometry" << std::endl;
}
} else if (relation.action == osmobjects::remove) {
// Delete a Relation geometry and its references.
Expand Down

0 comments on commit 85fb8e7

Please sign in to comment.