Hi Mark

Do remember the reason for having cityList and cites in PlacesFile.
In 854 you introduced the cityList in addition to the pre-existing
cities list.  The cities list became a list of unique city names per
country.  There is a problem that cityList.size() is the actual number
of city records written to LBL, but the number cities.size() is used
whenever you need to know how many cities there are, which is usually
less than cityList.size().

The problem occurs when cityList.size() is > 255 but cites.size() is
less than 256, when the cities get written as one byte values rather
than two bytes ones.  The number of cities is used in NET1 too and so
affects that unless the difference is intentional for NET1.

So do you think it is safe to use cityList.size() where ever the
number of cites is required as in the attached patch?

Everyone having assertion failures creating index files could try the
patch out and see if it helps.  You will have to re-create the .img file
with this patch applied, not just the index.

..Steve
Index: src/uk/me/parabola/imgfmt/app/lbl/PlacesFile.java
===================================================================
--- src/uk/me/parabola/imgfmt/app/lbl/PlacesFile.java	(revision 1029)
+++ src/uk/me/parabola/imgfmt/app/lbl/PlacesFile.java	Fri Nov 13 17:38:09 GMT 2009
@@ -22,14 +22,12 @@
 import java.util.List;
 import java.util.Map;
 
-import uk.me.parabola.imgfmt.app.trergn.Subdivision;
+import uk.me.parabola.imgfmt.app.Exit;
 import uk.me.parabola.imgfmt.app.ImgFileWriter;
 import uk.me.parabola.imgfmt.app.Label;
-
+import uk.me.parabola.imgfmt.app.trergn.Subdivision;
 import uk.me.parabola.util.Sortable;
 
-import uk.me.parabola.imgfmt.app.Exit;
-
 /**
  * This is really part of the LBLFile.  We split out all the parts of the file
  * that are to do with location to here.
@@ -96,7 +94,7 @@
 		byte poiglobalflags = placeHeader.getPOIGlobalFlags();
 		for (POIRecord p : pois)
 			p.write(writer, poiglobalflags,
-				writer.position() - poistart, cities.size(), postalCodes.size(), highways.size(), exitFacilities.size());
+				writer.position() - poistart, cityList.size(), postalCodes.size(), highways.size(), exitFacilities.size());
 		placeHeader.endPOI(writer.position());
 
 		int numPoiIndexEntries = 0;
@@ -285,8 +283,8 @@
 
 	void allPOIsDone() {
 
-		int index = 1;
 		Collections.sort(regionList);
+		int index = 1;
 		for (Sortable<String, Region> sr: regionList)
 			sr.getValue().setIndex(index++);
 
@@ -305,11 +303,11 @@
 
 		int ofs = 0;
 		for (POIRecord p : pois)
-			ofs += p.calcOffset(ofs, poiFlags, cities.size(), postalCodes.size(), highways.size(), exitFacilities.size());
+			ofs += p.calcOffset(ofs, poiFlags, cityList.size(), postalCodes.size(), highways.size(), exitFacilities.size());
 	}
 
 	public int numCities() {
-		return cities.size();
+		return cityList.size();
 	}
 
 	public int numZips() {
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to