Hi Andrzej,
too sad, this all sounds very reasonable :(
Besides that I found only one very small problem in splitter:
It uses a slightly different method to convert degrees to map units compared to
mkgmap.
I think the one used in mkgmap is good, the one in splitter is only close to
correct.
mkgmap:
public static int toMapUnit(double l) {
double DELTA = 360.0D / (1 << 24) / 2; // Correct rounding
if (l > 0)
return (int) ((l + DELTA) * (1 << 24) / 360);
return (int) ((l - DELTA) * (1 << 24) / 360);
}
splitter uses nearly the same code but
double DELTA = 0.000001; // TODO check if we really mean this
The value in mkgmap is 1.0728836059570312E-5 which is much closer to the exact
value 0,0000107288360595703125
The real problem is what you already described:
A 32 bit DEM value that is far from 0,0 and perfectly aligned to 1/1200°
degress is also perfectly aligned to 2^32 / (360 * 1200) which is ~
9942,0539259259259259259259259259
but it is never aligned to 9942.
Gerd
________________________________________
Von: mkgmap-dev <[email protected]> im Auftrag von Andrzej
Popowski <[email protected]>
Gesendet: Freitag, 19. Januar 2018 23:35:00
An: [email protected]
Betreff: Re: [mkgmap-dev] splitter r586 still doesn't always align properly
with --align-for-dem option
Hi Gerd,
> What makes you think that 0,0 is used instead of the upper left cornen
> given in the DEM section header(s)?
In Garmin's DEM coordinates are always a multiple of DEM pixel size
(dem-dists). The result is, that all DEMs data are aligned with 0;0. It
makes easy to join different tiles, since all tiles share the same
alignment.
Garmin uses DEM pixel size, which is not optimal for HGT. Looks like
they don't care about HGT alignment, while obviously they use SRTM data.
There should be no shifting of DEM, if DEM coordinates are strictly
respected by Mapsource od BaseCamp. But there could be artifacts on tile
borders.
Anyway, it is just a guess. We can make some test with Mapsource, but
would be difficult to test all different devices. That is why I would
prefer to make DEM exactly like Garmin, which means, that we can't get
good alignment with HGT.
--
Best regards,
Andrzej
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev