Skip to content

Commit 00e6912

Browse files
authored
Merge pull request #1773 from joto/fix-single-node-way
Revert "Fix: Create point geometry from collection with single-node way"
2 parents ccb6b18 + 663ecd1 commit 00e6912

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

src/geom-from-osm.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,6 @@ void create_collection(geometry_t *geom,
202202
if (line.size() >= 2U) {
203203
collection.add_geometry(std::move(item));
204204
}
205-
if (line.size() == 1) {
206-
collection.add_geometry(geometry_t{std::move(line[0])});
207-
}
208205
}
209206
}
210207

tests/bdd/flex/geometry-collection.feature

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Feature: Create geometry collections from relations
6161
| 10 |
6262
And the OSM data
6363
"""
64-
w20 Nn11
64+
w20 Nn10
6565
r30 Tname=foo Mn11@
6666
r31 Tname=bar Mw20@
6767
r32 Tname=baz Mw21@
@@ -74,7 +74,7 @@ Feature: Create geometry collections from relations
7474
| 31 | bar | NULL |
7575
| 32 | baz | NULL |
7676

77-
Scenario: Point entry generated for broken way lines
77+
Scenario: Null geometry generated for broken way lines
7878
Given the grid
7979
| 10 |
8080
And the OSM data
@@ -87,7 +87,24 @@ Feature: Create geometry collections from relations
8787
When running osm2pgsql flex
8888

8989
Then table osm2pgsql_test_collection contains exactly
90-
| osm_id | name | ST_NumGeometries(geom) | ST_AsText(ST_GeometryN(geom, 1)) |
91-
| 30 | w20 | 1 | 10 |
92-
| 31 | w21 | 1 | 10 |
90+
| osm_id | name | geom |
91+
| 30 | w20 | NULL |
92+
| 31 | w21 | NULL |
93+
94+
Scenario: No geometry generated for broken way lines, others are there
95+
Given the grid
96+
| 10 | 11 |
97+
| 13 | 12 |
98+
And the OSM data
99+
"""
100+
w20 Nn10,n11,n12,n13,n10
101+
w21 Nn10
102+
w22 Nn10,n11,n13
103+
r30 Tname=three Mw20@,w21@,w22@
104+
"""
105+
When running osm2pgsql flex
106+
107+
Then table osm2pgsql_test_collection contains exactly
108+
| osm_id | name | ST_NumGeometries(geom) | ST_AsText(ST_GeometryN(geom, 1)) | ST_AsText(ST_GeometryN(geom, 2)) |
109+
| 30 | three | 2 | 10, 11, 12, 13, 10 | 10, 11, 13 |
93110

tests/test-geom-collections.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,5 @@ TEST_CASE("create_collection from OSM data with single-node way", "[NoDB]")
8989

9090
auto const geom = geom::create_collection(buffer.buffer());
9191

92-
REQUIRE(geometry_type(geom) == "GEOMETRYCOLLECTION");
93-
REQUIRE(num_geometries(geom) == 1);
94-
95-
auto const &c = geom.get<geom::collection_t>();
96-
REQUIRE(c[0] == geom::geometry_t{geom::point_t{1, 1}});
92+
REQUIRE(geom.is_null());
9793
}

0 commit comments

Comments
 (0)