Skip to content

Commit 5768610

Browse files
committed
do not recheck for polygon tags in MPs
The tag type=multipolygon already indicates an area, no matter what the other tags say. Fixes #866.
1 parent 914ff8b commit 5768610

File tree

3 files changed

+10
-32
lines changed

3 files changed

+10
-32
lines changed

style.lua

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,6 @@ function filter_tags_relation_member (keyvalues, keyvaluemembers, roles, memberc
253253
elseif (type == "multipolygon") then
254254
-- Treat as polygon
255255
polygon = 1
256-
filter = 1
257-
-- Count the number of polygon tags of the object
258-
for i,k in ipairs(polygon_keys) do
259-
if keyvalues[k] then
260-
filter = 0
261-
break
262-
end
263-
end
264256
end
265257

266258
-- Add z_order key/value combination and determine if the object should also be added to planet_osm_roads

tagtransform-c.cpp

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ bool c_tagtransform_t::filter_tags(osmium::OSMObject const &o, int *polygon,
160160
if (o.type() == osmium::item_type::relation &&
161161
strcmp("type", k) == 0) {
162162
out_tags.emplace_back(k, v);
163-
filter = false;
164163
continue;
165164
}
166165
/* Allow named islands to appear as polygons */
@@ -210,7 +209,6 @@ bool c_tagtransform_t::filter_rel_member_tags(
210209
int *roads, export_list const &exlist, taglist_t &out_tags,
211210
bool allow_typeless)
212211
{
213-
auto const &infos = exlist.get(osmium::item_type::way);
214212
//if it has a relation figure out what kind it is
215213
const std::string *type = rel_tags.get("type");
216214
bool is_route = false, is_boundary = false, is_multipolygon = false;
@@ -239,6 +237,10 @@ bool c_tagtransform_t::filter_rel_member_tags(
239237
out_tags.push_dedupe(rel_tag);
240238
}
241239

240+
if (out_tags.empty()) {
241+
return true;
242+
}
243+
242244
if (is_route) {
243245
const std::string *netw = rel_tags.get("network");
244246
int networknr = -1;
@@ -313,25 +315,9 @@ bool c_tagtransform_t::filter_rel_member_tags(
313315
*make_boundary = 1;
314316
} else if (is_multipolygon) {
315317
*make_polygon = 1;
316-
317-
// Check if any of the tags is polygon-like
318-
int flags = 0;
319-
bool filter = false;
320-
for (const auto &tag : out_tags) {
321-
check_key(infos, tag.key.c_str(), &filter, &flags, false);
322-
}
323-
324-
if (!(flags & FLAG_POLYGON)) {
325-
out_tags.clear();
326-
return true;
327-
}
328-
}
329-
330-
if (out_tags.empty()) {
331-
return true;
332318
}
333319

334320
add_z_order(out_tags, roads);
335321

336-
return 0;
322+
return false;
337323
}

tests/regression-test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,17 @@
8989
( 51, 'Basic hstore point count', 'SELECT count(*) FROM planet_osm_point;', 1360 ),
9090
( 52, 'Basic hstore line count', 'SELECT count(*) FROM planet_osm_line;', 3254 ),
9191
( 53, 'Basic hstore road count', 'SELECT count(*) FROM planet_osm_roads;', 375 ),
92-
( 54, 'Basic hstore polygon count', 'SELECT count(*) FROM planet_osm_polygon;', 4130 ),
92+
( 54, 'Basic hstore polygon count', 'SELECT count(*) FROM planet_osm_polygon;', 4131 ),
9393
( 55, 'Basic post-diff point count', 'SELECT count(*) FROM planet_osm_point;', 1475 ),
9494
( 56, 'Basic post-diff line count', 'SELECT count(*) FROM planet_osm_line;', 3297 ),
9595
( 57, 'Basic post-diff road count', 'SELECT count(*) FROM planet_osm_roads;', 380 ),
96-
( 58, 'Basic post-diff polygon count', 'SELECT count(*) FROM planet_osm_polygon;', 4277 ),
96+
( 58, 'Basic post-diff polygon count', 'SELECT count(*) FROM planet_osm_polygon;', 4278 ),
9797
( 59, 'Extra hstore full tags point count',
9898
'SELECT count(*) FROM planet_osm_point WHERE tags ? \'osm_user\' and tags ? \'osm_version\' and tags ? \'osm_uid\' and tags ? \'osm_changeset\'', 1360),
9999
( 60, 'Extra hstore full tags line count',
100100
'SELECT count(*) FROM planet_osm_line WHERE tags ? \'osm_user\' and tags ? \'osm_version\' and tags ? \'osm_uid\' and tags ? \'osm_changeset\'', 3254),
101101
( 61, 'Extra hstore full tags polygon count',
102-
'SELECT count(*) FROM planet_osm_polygon WHERE tags ? \'osm_user\' and tags ? \'osm_version\' and tags ? \'osm_uid\' and tags ? \'osm_changeset\'', 4130),
102+
'SELECT count(*) FROM planet_osm_polygon WHERE tags ? \'osm_user\' and tags ? \'osm_version\' and tags ? \'osm_uid\' and tags ? \'osm_changeset\'', 4131),
103103
( 62, 'removed', 'really', 0),
104104
( 63, 'removed', 'really', 0),
105105
( 64, 'Multipolygon non copying of tags from outer with polygon tags on relation',
@@ -152,11 +152,11 @@
152152
( 93, 'Basic number of hstore points tags', 'SELECT sum(array_length(akeys(tags),1)) FROM planet_osm_point;', 4228),
153153
( 94, 'Basic number of hstore roads tags', 'SELECT sum(array_length(akeys(tags),1)) FROM planet_osm_roads;', 2317),
154154
( 95, 'Basic number of hstore lines tags', 'SELECT sum(array_length(akeys(tags),1)) FROM planet_osm_line;', 10387),
155-
( 96, 'Basic number of hstore polygons tags', 'SELECT sum(array_length(akeys(tags),1)) FROM planet_osm_polygon;', 9536),
155+
( 96, 'Basic number of hstore polygons tags', 'SELECT sum(array_length(akeys(tags),1)) FROM planet_osm_polygon;', 9538),
156156
( 97, 'Diff import number of hstore points tags', 'SELECT sum(array_length(akeys(tags),1)) FROM planet_osm_point;', 4352),
157157
( 98, 'Diff import number of hstore roads tags', 'SELECT sum(array_length(akeys(tags),1)) FROM planet_osm_roads;', 2336),
158158
( 99, 'Diff import number of hstore lines tags', 'SELECT sum(array_length(akeys(tags),1)) FROM planet_osm_line;', 10505),
159-
( 100, 'Diff import number of hstore polygons tags', 'SELECT sum(array_length(akeys(tags),1)) FROM planet_osm_polygon;', 9830),
159+
( 100, 'Diff import number of hstore polygons tags', 'SELECT sum(array_length(akeys(tags),1)) FROM planet_osm_polygon;', 9832),
160160
#**** Tests to check if inner polygon appears when outer tags change after initially identicall inner and outer way tags in a multi-polygon ****
161161
#**** These tests are currently broken and noted in trac ticket #2853 ****
162162
( 101, 'Multipolygon identical tags on inner and outer (presence of relation)',

0 commit comments

Comments
 (0)