Opened 11 years ago

Closed 8 years ago

#523 closed defect/bug (fixed)

Maptool's osm.c and Navit's binfile.c treat "districts" inconsistently, breaking search

Reported by: troy_rollo Owned by: cp15
Priority: major Milestone:
Component: mapdrivers/OSM Version: git master
Severity: Keywords:

Description (last modified by usul)

osm.c puts "district" data in the attr_town_* attributes. binfile.c expects to find it in attr_district_* attributes. As a result, the search dialog does not find suburbs, even if they have appropriate is_in tags.

In osm.c:

                if (item_is_town(*item_bin) && attr_strings[attr_string_label]) {
                                if (result->file) {
                                        item_bin_init(item_bin, item_bin->type);
                                        item_bin_add_coord(item_bin, &ni->c, 1);
                                        item_bin_add_attr_string(item_bin, attr_town_postal, postal);
                                        item_bin_add_attr_string(item_bin, attr_town_name, attr_strings[attr_string_label]);
                                        item_bin_write_match(item_bin, attr_town_name, attr_town_name_match, result->file);

In binfile.c:

                        if (item_is_town(*it) && !item_is_district(*it) && map_search->search->type != attr_district_name) {
                                if (binfile_attr_get(it->priv_data, attr_town_name_match, &at) || binfile_attr_get(it->priv_data, attr_town_name, &at)) {
                                        if (!ascii_cmp(at.u.str, map_search->search->u.str, map_search->partial) && !duplicate(map_search, it, attr_town_name)) 
                                                return it;
                        if (item_is_district(*it) && map_search->search->type != attr_town_name) {
                                if (binfile_attr_get(it->priv_data, attr_district_name_match, &at) || binfile_attr_get(it->priv_data, attr_district_name, &at)) {
                                        if (!ascii_cmp(at.u.str, map_search->search->u.str, map_search->partial) && !duplicate(map_search, it, attr_district_name)) 
                                                return it;

Attachments (1)

osm-diffs (7.5 KB) - added by 11 years ago.
Patch that includes a fix for this problem

Download all attachments as: .zip

Change History (5)

Changed 11 years ago by

Patch that includes a fix for this problem

comment:1 Changed 11 years ago by

The patch includes a fix for this problem and other problems affecting searching in Australia. Using the Cloudmade extract for Australia, the following command gives a reasonable (but by no means perfect) result:

bzcat australia.osm.bz2 | maptool -z 9 --country=Australia australia.bin

In Australia there are also polygons available for towns and suburbs, which I have not dealt with.

comment:2 Changed 10 years ago by korrosa

Is this still an issue?

comment:3 Changed 10 years ago by troy_rollo

I am not in a position to test this at the moment, but checking the source code suggests the problem is still there as I see no relevant change to either file.

comment:4 Changed 8 years ago by usul

  • Description modified (diff)
  • Resolution set to fixed
  • Status changed from new to closed

During the past months there was huge amount on fixing a lot of things related to the address hierachies. As there aren't any examples to test against the current SVN, I will close the ticket for now.

Anyway, thanks for donating your time to improve Navit :)

Note: See TracTickets for help on using tickets.