logo separator

[mkgmap-dev] Question regarding alignment of tiles in splitter

From Steve Ratcliffe steve at parabola.me.uk on Fri Nov 23 19:49:42 GMT 2012

On 23/11/12 17:18, GerdP wrote:
> Hi all,
>
> I am working on a better split algorithm. Now I wonder why the split
> algorithm in r202 makes sure that tiles are aligned in a special way. A
> comment in main says:
> 	// The maximum resolution of the map to be produced by mkgmap. This is a
> value in the range
> 	// 0-24. Higher numbers mean higher detail. The resolution determines how
> the tiles must
> 	// be aligned. Eg a resolution of 13 means the tiles need to have their
> edges aligned to
> 	// multiples of 2 ^ (24 - 13) = 2048 map units, and their widths and
> heights must be a multiple
> 	// of 2 * 2 ^ (24 - 13) = 4096 units. The tile widths and height multiples
> are double the tile
> 	// alignment *because the center point of the tile is stored, *and that
> must be aligned the
> 	// same as the tile edges are.
> 	private int resolution;
> I think this is no longer true. Would it be okay to split tiles to single
> alignment (e.g. 2048 for resolution 13)
> or does something in mkgmap rely on these doubled values?

There are actually no required alignment requirements at all in the img
format. A tile can have arbitary boundaries, it does not even have to be
rectangular; it can follow a country border for example.

So it is all about how mkgmap deals with it.

I think that the statement "because the center point of the tile is
stored," refers to the subdivisions within a tile, so it is still true
and always will be. My maths may be wrong though ;)

If you don't have a boundary that is aligned then at low zooms
you have points that should be on the boundary that fall between
two points on the low resolution grid. In this case the questions
are:

1. Should you choose a point inside the boundary?
2. The point inside one tile and the point outside on the next
    tile (so that it is the same point)
3. Does it matter? You might get gaps at low zooms. I can't remember
    if that happened. Routing might be affected (though I doubt it).

The tdbfile may need fixing. The areas in the tdbfile are always
rectangular. They enclose the whole tile and can overlap.

You should just try it. It is quite possible that none of this matters
very and it just works with boundaries at arbitary alignments already.
If not it can be made to work because any limitation is in mkgmap and
not the format as far as I understand.

..Steve



More information about the mkgmap-dev mailing list