Skip to content

Commit f93b084

Browse files
committed
Revert "Fix: Create point geometry from collection with single-node way"
This reverts commit 748fc0a. Turns out this wasn't such a good idea, see #1767 for details. The gist of it is that we always return NULL geometry when there are problems and so this should be the case here also for consistency.
1 parent ccb6b18 commit f93b084

File tree

3 files changed

+5
-39
lines changed

3 files changed

+5
-39
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: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -61,33 +61,16 @@ 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@
6868
"""
6969
When running osm2pgsql flex
7070

7171
Then table osm2pgsql_test_collection contains exactly
72-
| osm_id | name | geom |
73-
| 30 | foo | NULL |
74-
| 31 | bar | NULL |
75-
| 32 | baz | NULL |
76-
77-
Scenario: Point entry generated for broken way lines
78-
Given the grid
79-
| 10 |
80-
And the OSM data
81-
"""
82-
w20 Nn10
83-
w21 Nn10,n10
84-
r30 Tname=w20 Mw20@
85-
r31 Tname=w21 Mw21@
86-
"""
87-
When running osm2pgsql flex
88-
89-
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 |
72+
| osm_id | name | ST_GeometryType(geom) |
73+
| 30 | foo | NULL |
74+
| 31 | bar | NULL |
75+
| 32 | baz | NULL |
9376

tests/test-geom-collections.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,3 @@ TEST_CASE("create_collection from no OSM data returns null geometry", "[NoDB]")
8181
REQUIRE(geometry_type(geom) == "NULL");
8282
REQUIRE(num_geometries(geom) == 0);
8383
}
84-
85-
TEST_CASE("create_collection from OSM data with single-node way", "[NoDB]")
86-
{
87-
test_buffer_t buffer;
88-
buffer.add_way("w20 Nn1x1y1");
89-
90-
auto const geom = geom::create_collection(buffer.buffer());
91-
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}});
97-
}

0 commit comments

Comments
 (0)