diff options
author | Stefan Wildemann <gta04@metalstrolche.de> | 2021-07-15 01:06:53 +0200 |
---|---|---|
committer | jkoan <jkoan@users.noreply.github.com> | 2021-07-15 06:15:58 +0200 |
commit | dbdbe0b43560fbc07a0cbacd8506db7d3fbc2cd7 (patch) | |
tree | 7a283d302b8cacfe0cb89430261de791b02a6fff /navit | |
parent | ea5a86beafcb52f54544e079ef7e4f8ac8b070f4 (diff) | |
download | navit-dbdbe0b43560fbc07a0cbacd8506db7d3fbc2cd7.tar.gz |
fix:maptool: filter out unknown multipolygons before processing
This commit causes maptool to filter out multipolygon relations
whose tags result in unknown binfile type if -n is given on command
line. May save a lot of processing time.
Diffstat (limited to 'navit')
-rw-r--r-- | navit/maptool/osm.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/navit/maptool/osm.c b/navit/maptool/osm.c index 288a227be..fcfc46b36 100644 --- a/navit/maptool/osm.c +++ b/navit/maptool/osm.c @@ -1656,6 +1656,12 @@ country_from_iso2(char *iso) { return country_from_countryid(country_id_from_iso2(iso)); } +static inline int filter_unknown(struct item_bin * ib) { + if(ignore_unknown && (ib->type==type_point_unkn || ib->type==type_street_unkn || ib->type==type_none)) + return 1; + return 0; +} + static inline void osm_end_relation_multipolygon (struct maptool_osm * osm) { if((!g_strcmp0(relation_type, "multipolygon")) && (!boundary)) { int count; @@ -1675,6 +1681,11 @@ static inline void osm_end_relation_multipolygon (struct maptool_osm * osm) { //fprintf(stderr, "relation id "OSMID_FMT": got %d types\n", osmid_attr_value, count); item_bin_add_attr_string(tmp_item_bin, attr_label, attr_strings[attr_string_label]); for(a=0; a < count ; a++) { + /*Don't write out multipolygons that will result in unknown types if -n is given. + *So we don't process useless multipolygons. May save a lot of time. + */ + if(filter_unknown(tmp_item_bin)) + continue; /* no need to clone the item in memory. We just write it out multiple times */ if(a==1) { /*add duplicate tag if 2nd type. The tag stays for all subsequent writes */ |