Find by name - experimental patch

Hi Folks, I recently discovered OSM, josm, mkgmap, etc. it's interesting stuff. As part of my contribution to the general effort, I have been working on getting the garmin "find by name" function working with city names contained in maps generated from OSM files. I believe I have the basis of a solution and the attached patch works for me - YMMV. I am posting it here so that it can be tested on more maps and gps types (I am using a etrex vista) and see if it works OK. Note that the patch hard codes the map's country name to GBR (UNITED KINGDOM). Obviously, that will need to be configurable but I haven't yet worked out the best way of achieving that. You must use a non-6 bit character set. I use the --latin1 option. So, if you can, please try the attached patch and see if it works for you. Obviously, if it breaks other stuff, we need to fix that right away. Cheers, Mark

I forgot to mention that you need to use type codes for your cities from 0x0100 to 0x1100 (inclusive). I am using my gps for bicycle navigation around small villages and these codes work well for me in terms of the zooming behaviour of the city labels. place=city [0x0800 resolution 17] place=hamlet [0x0d00 resolution 20] place=suburb [0x0e00 resolution 20] place=town [0x0b00 resolution 18] place=village [0x0c00 resolution 20]

Folks, Here's a further patch that provides --country-name and --country-abbr options that allow you to specify the country name and abbreviation. The defaults are still "UNITED KINGDOM" and "GBR" (they have to be something!) Thanks to Steve for a hint as to how to implement this. Cheers, Mark

And here's yet another patch. I have added --region-name and --region-abbr options to set the maps's region name and abbreviated region name. There is no default value for these options. If you don't set them, the map has no region name or abbreviated region name. The patch is not in addition to the previous patches, it replaces them and contains all of the new code.

Hi Mark, thanks for the patch. I just tested your code with my nuvi 360 and the city search seams to work. I only had to add 2 null pointer checks otherwise I ran into exceptions. Looks like I have some unnamed cities in my area. Patch is attached ... I also did some experiments on the point index city stuff some weeks ago. I think I was really close but the city search never worked for me. Maybe I just stopped too early because I checked the effects in GPSMapEdit and city list was always screwed up. Looks like point index support is broken in it since "your" maps will also screw up GPSMapEdit city list. Anyway I could provide some experimental code which automatically fills the country, region information at least for areas where OpenGeoDB information is imported into osm. I think this is only available for Germany, Austria and Switzerland right now. I also have added Simple/Complex Housenumber and Phone Support for POIs. I fill in this information using the Karlsruhe Address Tags. I think I could send a experimental patch with my changes in the next days. Have to update my working branch first ... Thanks Berni. Mark Burton schrieb:
And here's yet another patch.
I have added --region-name and --region-abbr options to set the maps's region name and abbreviated region name.
There is no default value for these options. If you don't set them, the map has no region name or abbreviated region name.
The patch is not in addition to the previous patches, it replaces them and contains all of the new code.
------------------------------------------------------------------------
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Index: src/uk/me/parabola/mkgmap/build/MapBuilder.java =================================================================== --- src/uk/me/parabola/mkgmap/build/MapBuilder.java (revision 144) +++ src/uk/me/parabola/mkgmap/build/MapBuilder.java (working copy) @@ -166,7 +166,7 @@ // collect the names of the cities for (MapPoint p : src.getPoints()) { - if(p.isCity()) { + if(p.isCity() && p.getName() != null ) { sortedCities.put(p.getName(), null); } } @@ -413,7 +413,7 @@ POIRecord r = poimap.get(point); if (r != null) p.setPOIRecord(r); - if(point.isCity()) { + if(point.isCity() && point.getName() != null) { City c = sortedCities.get(point.getName()); if(pointIndex > 255) {

Hi Bernard,
thanks for the patch. I just tested your code with my nuvi 360 and the city search seams to work. I only had to add 2 null pointer checks otherwise I ran into exceptions. Looks like I have some unnamed cities in my area. Patch is attached ...
Thanks for the patch, I will incorporate it.
I also did some experiments on the point index city stuff some weeks ago. I think I was really close but the city search never worked for me. Maybe I just stopped too early because I checked the effects in GPSMapEdit and city list was always screwed up. Looks like point index support is broken in it since "your" maps will also screw up GPSMapEdit city list.
Yes, I have now fixed the problem so that gpsmapedit city list is not broken - new patch will be issued shortly However, it still doesn't enable the "find by name" menu option in mapsource. I am trying to find out why but as I don't use mapsource, I am not so motivated!
Anyway I could provide some experimental code which automatically fills the country, region information at least for areas where OpenGeoDB information is imported into osm. I think this is only available for Germany, Austria and Switzerland right now. I also have added Simple/Complex Housenumber and Phone Support for POIs. I fill in this information using the Karlsruhe Address Tags.
I think I could send a experimental patch with my changes in the next days. Have to update my working branch first ...
My latest code allows you to specify country/region through options. It would certainly be good to also have an option "autodetect-region" or similar that does the internet lookup. Cheers, Mark

Hi Mark,
I also did some experiments on the point index city stuff some weeks ago. I think I was really close but the city search never worked for me. Maybe I just stopped too early because I checked the effects in GPSMapEdit and city list was always screwed up. Looks like point index support is broken in it since "your" maps will also screw up GPSMapEdit city list.
Yes, I have now fixed the problem so that gpsmapedit city list is not broken - new patch will be issued shortly
However, it still doesn't enable the "find by name" menu option in mapsource. I am trying to find out why but as I don't use mapsource, I am not so motivated!
I'm also no mapsource user. The most mysterious question for me is still what we have to do to enable the "Address" input function in the nuvi. Mine still asks to "Spell County" but has no county. It should ask for a Country first but it looks like we have a US only map flag or something set by accident. I hope this is not part of some other img sections we don't have information about. Thanks Berni.

Bernhard Heibler escribió:
Hi Mark,
I also did some experiments on the point index city stuff some weeks ago. I think I was really close but the city search never worked for me. Maybe I just stopped too early because I checked the effects in GPSMapEdit and city list was always screwed up. Looks like point index support is broken in it since "your" maps will also screw up GPSMapEdit city list.
Yes, I have now fixed the problem so that gpsmapedit city list is not broken - new patch will be issued shortly
However, it still doesn't enable the "find by name" menu option in mapsource. I am trying to find out why but as I don't use mapsource, I am not so motivated! I'm also no mapsource user. The most mysterious question for me is still what we have to do to enable the "Address" input function in the nuvi. Mine still asks to "Spell County" but has no county. It should ask for a Country first but it looks like we have a US only map flag or something set by accident. I hope this is not part of some other img sections we don't have information about. My Nuvi 300 does ask for a country but doesn't have any to spell. Carlos

On Thu, Jan 29, 2009 at 09:42:08PM +0100, Bernhard Heibler wrote:
I'm also no mapsource user. The most mysterious question for me is still what we have to do to enable the "Address" input function in the nuvi. Mine still asks to "Spell County" but has no county. It should ask for a Country first but it looks like we have a US only map flag or something set by accident. I hope this is not part of some other img sections we don't have information about.
The full Find functionality uses on the MDR file. This file is not fully understood, although some progress has been made in working it out. ..Steve

Folks, I attach v3 of the patch - this one should generate maps that will work with gpsmapedit (city list will no longer be rubbish/empty). It should also cope with unnamed cities (Bernhard, please test!) It still does not enable the "find by name" option in mapsource (do I really care?) so something must not be quite right. Comments/fixes welcome. Cheers, Mark

Hi
I attach v3 of the patch - this one should generate maps that will work with gpsmapedit (city list will no longer be rubbish/empty). It should also cope with unnamed cities (Bernhard, please test!)
As you've probably noticed I've commited the patch in its separate parts as it looks good to me. I'd already noticed the null pointer problems so it might be slightly out of order, but I hope I got the end result correct. Thanks, this is a great new feature. Perhaps we should change the default country name to something more neutral like 'COUNTRY' or something. ..Steve

Mark Burton escribió:
Folks,
I attach v3 of the patch - this one should generate maps that will work with gpsmapedit (city list will no longer be rubbish/empty). It should also cope with unnamed cities (Bernhard, please test!)
It still does not enable the "find by name" option in mapsource (do I really care?) so something must not be quite right.
Thanks for implementing find by name feature. I've been trying to test it in a nuvi 300, but I didn't succeed. I used r856 to generate a map typing: /java -enableassertions -jar mkgmap.jar --route --latin1 --gmapsupp --country-name=Espa\361a ../osm2mp/viajes.mp/ If I try to search in the resulting map by address, no State/Province is found in the database. Also if I try to spell a city, no one appears. What I'm I doing wrong? Could you explain how to get this new feature functioning? Best in wiki [1] to be useful for more people. Kind regards Carlos [1] http://wiki.openstreetmap.org/index.php/Mkgmap#Installing
Comments/fixes welcome.
Cheers,
Mark
------------------------------------------------------------------------
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
-- Por favor, no me envíe documentos con extensiones .doc, .docx, .xls, .xlsx, .ppt, .pptx, .mdb, mdbx Instale OpenOffice desde http://es.openoffice.org/programa/index.html OpenOffice es libre: se puede copiar, modificar y redistribuir libremente. OpenOffice es gratis. El uso de OpenOffice es totalmente legal. OpenOffice funciona mejor que otros paquetes de oficina. OpenOffice está en continuo desarrollo y no tendrá que pagar por las nuevas versiones.

Hi Carlos,
Thanks for implementing find by name feature. I've been trying to test it in a nuvi 300, but I didn't succeed. I used r856 to generate a map typing: /java -enableassertions -jar mkgmap.jar --route --latin1 --gmapsupp --country-name=Espa\361a ../osm2mp/viajes.mp/
That looks OK - I haven't tried using --route recently but I can't think why that would make a difference to the find stuff.
If I try to search in the resulting map by address, no State/Province is found in the database. Also if I try to spell a city, no one appears. What I'm I doing wrong? Could you explain how to get this new feature functioning? Best in wiki [1] to be useful for more people.
I have only tested this on a eTrex Vista. I am only finding cities by name, not general POIs. On the etrex, I use the icons to go to Find and then City. At that point, it will list the names of cities nearby and you can then either pick one of the listed names or use the menu to select the "find by name" function. It then lets me enter the name using the joystick and does the incremental search. Just a thought, try setting a country abbreviation as well as the name. On the etrex, the city names all have the abbreviation as a suffix. Cheers, Mark

Mark Burton escribió:
Hi Carlos,
Thanks for implementing find by name feature. I've been trying to test it in a nuvi 300, but I didn't succeed. I used r856 to generate a map typing: /java -enableassertions -jar mkgmap.jar --route --latin1 --gmapsupp --country-name=Espa\361a ../osm2mp/viajes.mp/
That looks OK - I haven't tried using --route recently but I can't think why that would make a difference to the find stuff.
If I try to search in the resulting map by address, no State/Province is found in the database. Also if I try to spell a city, no one appears. What I'm I doing wrong? Could you explain how to get this new feature functioning? Best in wiki [1] to be useful for more people.
I have only tested this on a eTrex Vista.
I am only finding cities by name, not general POIs.
On the etrex, I use the icons to go to Find and then City. At that point, it will list the names of cities nearby and you can then either pick one of the listed names or use the menu to select the "find by name" function. It then lets me enter the name using the joystick and does the incremental search.
I see the find function interface is different in eTrex and Nuvi. In nuvi, you have several ways to find a place: -Address: when you select this one, you are prompted about a State/Province and you have to spell it. If your spelling doesn't match a name in the device database you can't continue with the next step, City/Postal code. Currently no State name appears in my mkgmap generated maps, despite the use of --country-name option. -Find by name: you can spell name of any POI. As cities are treated as poi's (if I understood right), they should be in the database, but they aren't.
Just a thought, try setting a country abbreviation as well as the name. On the etrex, the city names all have the abbreviation as a suffix.
I did, but nothing changed.
Cheers,
Mark
-- Por favor, no me envíe documentos con extensiones .doc, .docx, .xls, .xlsx, .ppt, .pptx, .mdb, mdbx Instale OpenOffice desde http://es.openoffice.org/programa/index.html OpenOffice es libre: se puede copiar, modificar y redistribuir libremente. OpenOffice es gratis. El uso de OpenOffice es totalmente legal. OpenOffice funciona mejor que otros paquetes de oficina. OpenOffice está en continuo desarrollo y no tendrá que pagar por las nuevas versiones.

Carlos,
I see the find function interface is different in eTrex and Nuvi. In nuvi, you have several ways to find a place: -Address: when you select this one, you are prompted about a State/Province and you have to spell it. If your spelling doesn't match a name in the device database you can't continue with the next step, City/Postal code. Currently no State name appears in my mkgmap generated maps, despite the use of --country-name option. -Find by name: you can spell name of any POI. As cities are treated as poi's (if I understood right), they should be in the database, but they aren't.
Just a thought, try setting a country abbreviation as well as the name. On the etrex, the city names all have the abbreviation as a suffix.
I did, but nothing changed.
I don't know what's wrong but you could at least check that the img file contains the names. Get gpsmapedit if you don't already have it and open your gmapsupp.img. Go to Tools->Edit Postal Address Items and check that you can see your country/region/city names. If they are visible and look like you expect then, obviously, we need to do more work on this to make it function on the Nuvi. Cheers, Mark

Also, I wonder if it's not working on the Nuvi for the same reason as it doesn't work in MapSource?

Mark Burton escribió:
I don't know what's wrong but you could at least check that the img file contains the names.
Get gpsmapedit if you don't already have it and open your gmapsupp.img.
Go to Tools->Edit Postal Address Items and check that you can see your country/region/city names.
I can see country as introduced by --country-name and country-abbr options, but no cities that should be taken from nodes tagged as place=city
If they are visible and look like you expect then, obviously, we need to do more work on this to make it function on the Nuvi.
You are right. I know really little about this matter, but any help I can give, just tell me. Regards Carlos

Carlos, Check that you are using code values for your cities/towns/villages/hamlets in the range 0x0100 to 0x1100 - they won't be recognised as cities if the codes are outside of this range. Cheers, Mark

It also seems to have fixed a problem I had on my Edge 605 (See [mkgmap-dev] Garmin "Feature" or bug? 24/01/09). This also means it will probably work on an Edge 705. Thanks Paul Mark Burton wrote:
Hi Carlos,
Thanks for implementing find by name feature. I've been trying to test it in a nuvi 300, but I didn't succeed. I used r856 to generate a map typing: /java -enableassertions -jar mkgmap.jar --route --latin1 --gmapsupp --country-name=Espa\361a ../osm2mp/viajes.mp/
That looks OK - I haven't tried using --route recently but I can't think why that would make a difference to the find stuff.
If I try to search in the resulting map by address, no State/Province is found in the database. Also if I try to spell a city, no one appears. What I'm I doing wrong? Could you explain how to get this new feature functioning? Best in wiki [1] to be useful for more people.
I have only tested this on a eTrex Vista.
I am only finding cities by name, not general POIs.
On the etrex, I use the icons to go to Find and then City. At that point, it will list the names of cities nearby and you can then either pick one of the listed names or use the menu to select the "find by name" function. It then lets me enter the name using the joystick and does the incremental search.
Just a thought, try setting a country abbreviation as well as the name. On the etrex, the city names all have the abbreviation as a suffix.
Cheers,
Mark _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi Mark,
I attach v3 of the patch - this one should generate maps that will work with gpsmapedit (city list will no longer be rubbish/empty). It should also cope with unnamed cities (Bernhard, please test!)
just want to let you know that R857 works with the Nuvi. I also found out that sorting the cities seams to be important for it. If it is not sorted the country/county info is missing in the nearest city list. Sometimes this info is not displayed for entries of city names that exists more then once. But if I search for the name the list is correct. Strange but it is ok. Thanks for this nice feature. Thanks Berni.
participants (5)
-
Bernhard Heibler
-
Carlos Dávila
-
Mark Burton
-
Paul
-
Steve Ratcliffe