logo separator

[mkgmap-dev] POIRecord and PlacesHeader

From Mark Burton markb at ordern.com on Fri Nov 13 18:38:25 GMT 2009

Hi Steve,

> 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().

Oh dear, why didn't I put some comments in at the time!

So let's see...

When processing the cities, unique is true so that a new City object
will be created for each city in the map. Good.

When processing the POIs it should not create a new City object unless
the POI cites a city name that doesn't actually exist already (which is
probably bad anyway).

> 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, there will be a difference in the sizes of cities and cityList if a
given country or region has more than one city with the same name
(which you would actually expect to happen quite often).

The cityList will have the right number of elements but cities will
have too few when names+region/country are duplicated. I think that has
to be a bug.

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

That does sound sensible. I am just wondering why we need to keep
cities at all given that when you have multiple cities with the same
name in the same region/country it will return you the wrong one some
of the time!

I need to think about this some more but off the top of my
head, I reckon that we should get rid of cities and, instead, add the
ability to find an entry in cityList given a city name and the
country/region it's in. So that in createCity() if unique is false, we
look up the city in cityList.
> 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



More information about the mkgmap-dev mailing list