logo separator

[mkgmap-dev] HGT - getElevation()

From Gerd Petermann gpetermann_muenchen at hotmail.com on Tue Jan 9 14:49:20 GMT 2018

Hi Andrzej,

to be honest I did not understand the math, that's why I've copied the code from Frank.
Maybe I've done something wrong with the calculation of dx and dy.

Do you think that Franks code has the same problem?

Gerd

________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <popej at poczta.onet.pl>
Gesendet: Dienstag, 9. Januar 2018 15:45:14
An: mkgmap-dev at lists.mkgmap.org.uk
Betreff: Re: [mkgmap-dev] HGT - getElevation()

Hi Gerd,

I'm trying to find if resolution can be better. I think current
interpolation is not good. Imagine two combination of 4-points heights
from HGT with values like:

1 0
0 7

and

0 1
7 0

For a point in the middle of rectangle, current interpolation would give
result 0 in first case and 4 in second, while I would expect 2 in both
cases.

I think the code, which calculates interpolation based on 3 points,
should be used only if the forth is void. There could be 3 combinations
of triangles in this case. But if all 4 points are valid, there should
be applied standard bilinear interpolation. Something like:

if (hlb == HGTReader.UNDEF) {
        return triangle(...
}
if (hrb == HGTReader.UNDEF) {
        return triangle(...
}
if (hlt == HGTReader.UNDEF) {
        return triangle(...
}
if (hrt == HGTReader.UNDEF) {
        return triangle(...
}

// 4 points valid
return bilinear(...


--
Best regards,
Andrzej

_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


More information about the mkgmap-dev mailing list