[mkgmap-dev] multi-word street search
From Andrzej Popowski popej at poczta.onet.pl on Thu Dec 4 23:19:28 GMT 2014
Hi, I have decided to try simple solution for this problem. I have modified addStreet() procedure in file imgfmt\app\mdr\MDRFile.java. While I don't know all ramification of this change, search seems to work as expected, see attached picture form Mapsource. Attached patch is created half-manually, I hope it will work in your environment. -- Best regards, Andrzej -------------- next part -------------- --- src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java Wed Jun 25 15:52:12 2014 +++ src/uk/me/parabola/imgfmt/app/mdr/MDRFile.java Thu Dec 04 22:17:15 2014 @@ -223,14 +223,28 @@ String name = lab.getText(); String cleanName = cleanUpName(name); int strOff = createString(cleanName); // We sort on the dirty name (ie with the Garmin shield codes) although those codes do not // affect the sort order. The string for mdr15 does not include the shield codes. mdr7.addStreet(currentMap, name, lab.getOffset(), strOff, mdrCity); + + // try substrings + for (;;) { + int spaceOff = name.indexOf(" "); + if (spaceOff < 0) + break; + name = name.substring(spaceOff +1); + name = name.trim(); + if (name.length() <= 2) + break; + cleanName = cleanUpName(name); + strOff = createString(cleanName); + mdr7.addStreet(currentMap, name, lab.getOffset(), strOff, mdrCity); + } } } /** * Remove shields and other kinds of strange characters. Perform any * rearrangement of the name to make it searchable. * @param name The street name as read from the img file. -------------- next part -------------- A non-text attachment was scrubbed... Name: dudka.png Type: image/png Size: 12078 bytes Desc: not available URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20141205/55d00d0b/attachment-0001.png>
- Previous message: [mkgmap-dev] Commit: r3362: Fix size calculation for gmapsupp.
- Next message: [mkgmap-dev] multi-word street search
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list