Re: [mkgmap-dev] HGT - getElevation()

2018-01-21 Thread Andrzej Popowski
Hi, I'm attaching a next patch for bicubic interpolation. It include following changes: - some errors corrected, - more statistic of interpolation, - changed condition for applying bicubic interpolation. In this version bicubic interpolation is applied, when required DEM resolution is not

Re: [mkgmap-dev] HGT - getElevation()

2018-01-21 Thread Andrzej Popowski
Hi Gerd, > Bicubic expects grid [-1,0,1,2] X [-1,0,1,2] > fillArray uses [0,1,2,3]X[0,1,2,3] That's the reason for "-1" in following code: h = rdr.ele(xLeft + x - 1, yBottom + y - 1); eleArray[x][y] = h; I have corrected some errors, will post a new patch soon. -- Best regards, Andrzej

Re: [mkgmap-dev] HGT - getElevation()

2018-01-20 Thread Andrzej Popowski
Hi, here is my version of mkgmap for tests: http://files.mkgmap.org.uk/download/403/mkgmap-dem-tdb-r4071-bicubic.zip Changes are following: - dem-dists values are rounded to 16, - DEM coordinates are multiples of dem-dists, - DEM values are calculated with bicubic interpolation for layers with

Re: [mkgmap-dev] HGT - getElevation()

2018-01-20 Thread Andrzej Popowski
Hi Gerd, > Maybe you can create a 2nd branch so that others can try the > different results? I hardly know java, have no IDE for work or any experience in SVN. Basically I can tweak your code and compile it with ant. I could post compiled version if there is any interest. -- Best regards,

Re: [mkgmap-dev] HGT - getElevation()

2018-01-20 Thread Gerd Petermann
: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, I have included bicubic interpolation created by Ken Perlin: https://github.com/mlevans/pretty-heatmaps/blob/master/DensityArrayCreation/src/DensityArrayCreation/Bicubic.java Bicubic interpolation is used onl

Re: [mkgmap-dev] HGT - getElevation()

2018-01-19 Thread Andrzej Popowski
Hi, quick comparison between r4068 original and r4070 with bicubic interpolation. Both use pbf aligned to HGT and the same 3 arc degree HGT with many voids. http://files.mkgmap.org.uk/download/401/orig-aligned.png http://files.mkgmap.org.uk/download/402/bicu-aligned.png DEM shading moved

Re: [mkgmap-dev] HGT - getElevation()

2018-01-19 Thread Andrzej Popowski
Hi Gerd, I have included bicubic interpolation created by Ken Perlin: https://github.com/mlevans/pretty-heatmaps/blob/master/DensityArrayCreation/src/DensityArrayCreation/Bicubic.java Bicubic interpolation is used only for layers with good resolution (3 arc seconds or better). For other cases

Re: [mkgmap-dev] HGT - getElevation()

2018-01-19 Thread Andrzej Popowski
Hi Gerd, > I'd prefer to use unmodified dem-dist values for now, besides that the > unit tests don't compile with it. I'm trying to get DEM looking like in Garmins img. The actual rounding in code can be disabled, but then it would be up to user, to set correct distances. I don't know, if

Re: [mkgmap-dev] HGT - getElevation()

2018-01-18 Thread Gerd Petermann
that this is a bad idea. Gerd Von: mkgmap-dev <mkgmap-dev-boun...@lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <po...@poczta.onet.pl> Gesendet: Freitag, 19. Januar 2018 02:59:14 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkg

Re: [mkgmap-dev] HGT - getElevation()

2018-01-18 Thread Andrzej Popowski
Hi Gerd, I have prepared patch according to these guessed rules. It rounds dem-dist and shift coordinates of top-left corner of DEM areas. Since dem-dist doesn't correspond exactly to HGT, interpolation is always active. I think there could be 2 ways to improve DEM quality. Interpolation

Re: [mkgmap-dev] HGT - getElevation()

2018-01-18 Thread Andrzej Popowski
Hi Gerd, I have executed your script and looked at maps. I have tested them with artificial HGT too. Only the original-unaligned map has DEM at wrong position. It is moved by about 0.00033 degree right and down. I looked at offset calculated as (DEM coordinate)%(dem-dist) and only for this

Re: [mkgmap-dev] HGT - getElevation()

2018-01-17 Thread Gerd Petermann
ev <mkgmap-dev-boun...@lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <po...@poczta.onet.pl> Gesendet: Donnerstag, 18. Januar 2018 03:08:48 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, I have looked a bit at Garmin's DEM a

Re: [mkgmap-dev] HGT - getElevation()

2018-01-17 Thread Gerd Petermann
oun...@lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <po...@poczta.onet.pl> Gesendet: Mittwoch, 17. Januar 2018 23:24:35 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, I have tried to verify, if aligned DEM is correct. I think algorithm

Re: [mkgmap-dev] HGT - getElevation()

2018-01-17 Thread Andrzej Popowski
Hi Gerd, I have looked a bit at Garmin's DEM and I have some guesses. * Coordinate resolution for DEM is 28 bits. Since it is shifted to the left, 4 lower bits are always 0. * The same goes for pixel distance, lower 4 bits should be 0. This is the reason, why Garmin uses 3312 (CF0) instead

Re: [mkgmap-dev] HGT - getElevation()

2018-01-17 Thread Andrzej Popowski
Hi Gerd, I have tried to verify, if aligned DEM is correct. I think algorithm have passed positively 2 tests: - reading height from map gives correct values, - changing bbox of source data doesn't change resulting map, even if it changes offset applied for aligning. The aligning changes a

Re: [mkgmap-dev] HGT - getElevation()

2018-01-17 Thread Gerd Petermann
ki <po...@poczta.onet.pl> Gesendet: Mittwoch, 17. Januar 2018 22:36:08 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, I have compiled my 2 tiles and the one you found as a problematic. Now with SRTM 3 seconds. I have used mkgmap 4068 with your patch.

Re: [mkgmap-dev] HGT - getElevation()

2018-01-17 Thread Andrzej Popowski
Hi Gerd, I have compiled my 2 tiles and the one you found as a problematic. Now with SRTM 3 seconds. I have used mkgmap 4068 with your patch. It all looks good. Shading is the same on all maps, peak DEM height for a mountain is the same and nearly on the same position, which is at HGT node.

Re: [mkgmap-dev] HGT - getElevation()

2018-01-17 Thread Andrzej Popowski
Hi Gerd, I have prepared artificial HGT with both resolution and tested both. I haven't tested with real HGT 3". I will check this too. -- Best regards, Andrzej ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk

Re: [mkgmap-dev] HGT - getElevation()

2018-01-17 Thread Gerd Petermann
: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, > So I tried other bboxes, and found this one: > 2902: 2291022,918105 to 2297489,946049 I have compiled this tile and found no difference, it looks the same as my tiles. DEM heights are the same. I h

Re: [mkgmap-dev] HGT - getElevation()

2018-01-17 Thread Andrzej Popowski
Hi Gerd, > So I tried other bboxes, and found this one: > 2902: 2291022,918105 to 2297489,946049 I have compiled this tile and found no difference, it looks the same as my tiles. DEM heights are the same. I have prepared dummy HGT with checkerboard patter. It makes quite easy to verify,

Re: [mkgmap-dev] HGT - getElevation()

2018-01-17 Thread Gerd Petermann
Von: mkgmap-dev <mkgmap-dev-boun...@lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <po...@poczta.onet.pl> Gesendet: Dienstag, 16. Januar 2018 22:30:21 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, I have done 2 kind of

Re: [mkgmap-dev] HGT - getElevation()

2018-01-16 Thread Andrzej Popowski
Hi Gerd, I have done 2 kind of tests, both with mkgmap patched with your patch for aligned HGT. Fist test is more or less the same what you propose. I looked for a round peak on a map and then searched for the highest value of DEM on a peak, moving cursor around. With zoom 20m, I tried to

Re: [mkgmap-dev] HGT - getElevation()

2018-01-16 Thread Gerd Petermann
Von: mkgmap-dev <mkgmap-dev-boun...@lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <po...@poczta.onet.pl> Gesendet: Dienstag, 16. Januar 2018 16:36:22 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, I have tr

Re: [mkgmap-dev] HGT - getElevation()

2018-01-16 Thread Gerd Petermann
on Andrzej Popowski <po...@poczta.onet.pl> Gesendet: Dienstag, 16. Januar 2018 16:36:22 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, I have tried to align pbf bbox with HGT. I have ceated 2 maps, one with god alignment and second with left and top edge

Re: [mkgmap-dev] HGT - getElevation()

2018-01-16 Thread Gerd Petermann
Popowski <po...@poczta.onet.pl> Gesendet: Dienstag, 16. Januar 2018 16:36:22 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, I have tried to align pbf bbox with HGT. I have ceated 2 maps, one with god alignment and second with left and top edge moved by 1/2 HGT

Re: [mkgmap-dev] HGT - getElevation()

2018-01-16 Thread Andrzej Popowski
Hi Gerd, I have tried to align pbf bbox with HGT. I have ceated 2 maps, one with god alignment and second with left and top edge moved by 1/2 HGT pixel size. I have used HGT with resolution 3600, so the movement was about 15m. I think shading is the same on both maps. There is no obvious

Re: [mkgmap-dev] HGT - getElevation()

2018-01-16 Thread Gerd Petermann
-dev <mkgmap-dev-boun...@lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <po...@poczta.onet.pl> Gesendet: Montag, 15. Januar 2018 23:33:03 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, I use SRTM3 v3, so map can be different, but I

Re: [mkgmap-dev] HGT - getElevation()

2018-01-15 Thread Andrzej Popowski
Hi Gerd, I use SRTM3 v3, so map can be different, but I'm surprised by difference in details. That's why I wanted to recompile map. I can see shift in shading when aligning DEM, I told so in my first post. But I rather don't notice that shading doesn't fit map features. Probably this

Re: [mkgmap-dev] HGT - getElevation()

2018-01-15 Thread Gerd Petermann
: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, on your pictures it looks like shading form extended DEM doesn't match map features. Is it HGT with resolution 1200? Shading looks more detailed than on my map, which uses DEM created by BuidDemFile. I have to reco

Re: [mkgmap-dev] HGT - getElevation()

2018-01-15 Thread Andrzej Popowski
Hi Gerd, on your pictures it looks like shading form extended DEM doesn't match map features. Is it HGT with resolution 1200? Shading looks more detailed than on my map, which uses DEM created by BuidDemFile. I have to recompile my map to compare. I have done different test. I have analyzed

Re: [mkgmap-dev] HGT - getElevation()

2018-01-15 Thread Gerd Petermann
oun...@lists.mkgmap.org.uk> im Auftrag von Gerd Petermann <gpetermann_muenc...@hotmail.com> Gesendet: Montag, 15. Januar 2018 14:57:17 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Andrzej, ooops , just noticed that I did not update my patch. See new version attached. I am

Re: [mkgmap-dev] HGT - getElevation()

2018-01-15 Thread Gerd Petermann
-dev <mkgmap-dev-boun...@lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <po...@poczta.onet.pl> Gesendet: Montag, 15. Januar 2018 12:51:00 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, I guess your code already makes sure, that whole are

Re: [mkgmap-dev] HGT - getElevation()

2018-01-15 Thread Henning Scholland
Hi Gerd On 15.01.2018 15:05, Gerd Petermann wrote: > Wouldn't it be better to change splitter so that it aligns tiles to HGT > raster? As long as we have rectangle map tiles, it would be a possible solution. But in future we might have non-rectangle tiles or even tiles, not splitted by

Re: [mkgmap-dev] HGT - getElevation()

2018-01-15 Thread Andrzej Popowski
Hi Gerd, I guess your code already makes sure, that whole area is covered by DEM. So yes, extending bottom/right is not necessary. -- Best regards, Andrzej ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk

Re: [mkgmap-dev] HGT - getElevation()

2018-01-14 Thread Gerd Petermann
Von: mkgmap-dev <mkgmap-dev-boun...@lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <po...@poczta.onet.pl> Gesendet: Sonntag, 14. Januar 2018 16:46:29 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd,

Re: [mkgmap-dev] HGT - getElevation()

2018-01-14 Thread Andrzej Popowski
Hi Gerd, > you just want to achive that the calculated postions are as close as > possible to the positions in the hgt file Yes. Linear interpolation is averaging too. If DEM can use exact values form HGT, then there will be no averaging. Even interpolated values near HGT node should be the

Re: [mkgmap-dev] HGT - getElevation()

2018-01-14 Thread Gerd Petermann
create a new hgtConverter. Gerd Von: mkgmap-dev <mkgmap-dev-boun...@lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <po...@poczta.onet.pl> Gesendet: Sonntag, 14. Januar 2018 16:10:36 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkg

Re: [mkgmap-dev] HGT - getElevation()

2018-01-14 Thread Andrzej Popowski
Hi Gerd, > why you don't use the modified area for the hgtConverter as well? I need HGT resolution first. I guess resolution comes after initialization of hgtConverter. Probably area for hgtConverter should be expanded, or maybe initialized with a bit bigger area? -- Best regards, Andrzej

Re: [mkgmap-dev] HGT - getElevation()

2018-01-14 Thread Gerd Petermann
Sonntag, 14. Januar 2018 14:29:57 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, I have attempted to reduce interpolation, when DEM pixel size is the same as HGT pixel. I have stretched a bit area of DEM, so edges are aligned with HGT. I'm attac

Re: [mkgmap-dev] HGT - getElevation()

2018-01-14 Thread Andrzej Popowski
Hi Gerd, I have attempted to reduce interpolation, when DEM pixel size is the same as HGT pixel. I have stretched a bit area of DEM, so edges are aligned with HGT. I'm attaching a patch. Resulting map looks similar, only shading has moved a bit. I'm not sure if this is the result of

Re: [mkgmap-dev] HGT - getElevation()

2018-01-11 Thread Gerd Petermann
ag von Andrzej Popowski <po...@poczta.onet.pl> Gesendet: Donnerstag, 11. Januar 2018 16:50:13 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, I have uploaded at http://files.mkgmap.org.uk/ data for compilation, which gives me a map with shading er

Re: [mkgmap-dev] HGT - getElevation()

2018-01-11 Thread Andrzej Popowski
Hi Gerd, I have uploaded at http://files.mkgmap.org.uk/ data for compilation, which gives me a map with shading errors. Mkgmap version 4045. -- Best regards, Andrzej ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Andrzej Popowski
Hi Gerd, I will try to prepare a simple example. -- Best regards, Andrzej ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Gerd Petermann
018 22:11:12 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, yes, the problem is still present in 4041. -- Best regards, Andrzej ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.or

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Peter Danninger
Von: mkgmap-dev <mkgmap-dev-boun...@lists.mkgmap.org.uk> im Auftrag von Peter Danninger <pe...@danninger.eu> Gesendet: Mittwoch, 10. Januar 2018 17:53:46 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() I don't think rounding or i

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Andrzej Popowski
Hi, > If you interpolate altitude-values, you calculate wrong values > by design :-( Would it be possible, to create first layer without interpolation? On my maps I'm trying to set DEM resolution equal to HGT, but I can't control offset and I'm not sure if settings are precise enough to

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Gerd Petermann
Peter Danninger <pe...@danninger.eu> Gesendet: Mittwoch, 10. Januar 2018 17:53:46 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() I don't think rounding or interpolating will deliver any better results. If you have 1" .hgt files, you get an altitude value every

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Peter Danninger
foot Gerd Von: mkgmap-dev <mkgmap-dev-boun...@lists.mkgmap.org.uk> im Auftrag von Frank Stinner <frank.stin...@kabelmail.de> Gesendet: Mittwoch, 10. Januar 2018 17:27:22 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Gerd Petermann
Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd and Andrzej, i think "overkill" is a good word. For algorithm that'a only numbers, it does not matter. The questions is, how exact are the hgt-values. We don't know that, but i don't believe it is +-1m or so. I'm not wondering, wh

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Frank Stinner
Hi Gerd and Andrzej, i think "overkill" is a good word. For algorithm that'a only numbers, it does not matter. The questions is, how exact are the hgt-values. We don't know that, but i don't believe it is +-1m or so. I'm not wondering, when the hgt's have +-5m or +-10m. The copernicus-data

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Andrzej Popowski
Hi Gerd, height precision is 3 times better in feet and rounding errors smaller. It is probably overkill, but might be handy with good data. -- Best regards, Andrzej ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Gerd Petermann
Von: mkgmap-dev <mkgmap-dev-boun...@lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <po...@poczta.onet.pl> Gesendet: Mittwoch, 10. Januar 2018 16:14:15 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, no idea about i

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Andrzej Popowski
Hi Gerd, no idea about int vs. short, but I wouldn't expect any differences on Intel CPU. I think it could be interesting to return interpolated values in feet, assuming that you can encode whole DEM in feet. -- Best regards, Andrzej ___

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Gerd Petermann
kgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, I see you have introduced NO_VAL constant in recent code. Please note, then my interpolation code can return (double)HGTReader.UNDEF too, when it returns nearest HGT value, which happened to be void. I think more clear woul

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Andrzej Popowski
Hi Gerd, forgotten patch here. -- Best regards, Andrzej Index: src/uk/me/parabola/mkgmap/reader/hgt/HGTConverter.java === --- src/uk/me/parabola/mkgmap/reader/hgt/HGTConverter.java (revision 4042) +++

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Andrzej Popowski
Hi Gerd, I see you have introduced NO_VAL constant in recent code. Please note, then my interpolation code can return (double)HGTReader.UNDEF too, when it returns nearest HGT value, which happened to be void. I think more clear would be to move Math.round() to interpolatedHeight(), see

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Gerd Petermann
: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() On 10.01.2018 20:33, Andrzej Popowski wrote: > > i would be very defensive with interpolation in the case of > > missing values. > > I got the same feeling. The best way to fill voids is to process whole > HGT.

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Henning Scholland
On 10.01.2018 20:33, Andrzej Popowski wrote: > > i would be very defensive with interpolation in the case of > > missing values. > > I got the same feeling. The best way to fill voids is to process whole > HGT. And I believe that DEM providers already have done it, so any > attempt at simple

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Andrzej Popowski
Hi Frank and Gerd, > It's a little bit more to calculate The actual code is quite simple, it is 3 times linear interpolation: double hxt = (1.0D - qx)*hlt + qx*hrt; double hxb = (1.0D - qx)*hlb + qx*hrb; return (1.0D - qy)*hxb + qy*hxt; > i would be very defensive with interpolation in the

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Gerd Petermann
r 2018 10:53:44 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd and Andrzej, > your choice of triangle is arbitrary. of course, but the version with 4 triangles isn't. > bilinear interpolation seems better Yes. It's a little bit more to calculate, b

Re: [mkgmap-dev] HGT - getElevation()

2018-01-10 Thread Frank Stinner
Hi Gerd and Andrzej, > your choice of triangle is arbitrary. of course, but the version with 4 triangles isn't. > bilinear interpolation seems better Yes. It's a little bit more to calculate, but better. For our special case it is: h = h11 * (1 + y * x - x - y) + h21 * (x - y * x) + h12 *

Re: [mkgmap-dev] HGT - getElevation()

2018-01-09 Thread Andrzej Popowski
Hi Gerd, yes, the problem is still present in 4041. -- Best regards, Andrzej ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Re: [mkgmap-dev] HGT - getElevation()

2018-01-09 Thread Gerd Petermann
0 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi, Gerd, your additional interpolation would be redundant. Side note: comparison of double and integer doesn't look safe. Maybe would be better if interpolateHeight() returned integer? Frank, I understand your idea

Re: [mkgmap-dev] HGT - getElevation()

2018-01-09 Thread Andrzej Popowski
Hi, Gerd, your additional interpolation would be redundant. Side note: comparison of double and integer doesn't look safe. Maybe would be better if interpolateHeight() returned integer? Frank, I understand your idea, but please note, that your choice of triangle is arbitrary. There are 2

Re: [mkgmap-dev] HGT - getElevation()

2018-01-09 Thread Frank Stinner
Hi Andrzej and Gerd, for your examples 1 0 0 7 0 1 7 0 is 2 for the middlepoint mathematical correct: (h1 + h2 + h3 + h4) / 4. My interpolation is the that: We live in a world with "triangular" surface (like in a computergame). We looking for a point p for the "surrounding" 4 points from

Re: [mkgmap-dev] HGT - getElevation()

2018-01-09 Thread Gerd Petermann
et: Dienstag, 9. Januar 2018 19:10:15 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, I have prepared a patch with bilinear interpolation, which supports missing values. It can restore single missing value, but if more values are missing it simply returns th

Re: [mkgmap-dev] HGT - getElevation()

2018-01-09 Thread Gerd Petermann
ght? Gerd Von: mkgmap-dev <mkgmap-dev-boun...@lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <po...@poczta.onet.pl> Gesendet: Dienstag, 9. Januar 2018 15:45:14 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi Gerd, I'm trying to find if resol

Re: [mkgmap-dev] HGT - getElevation()

2018-01-09 Thread Gerd Petermann
dev-boun...@lists.mkgmap.org.uk> im Auftrag von Andrzej Popowski <po...@poczta.onet.pl> Gesendet: Dienstag, 9. Januar 2018 15:45:14 An: mkgmap-dev@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 i

Re: [mkgmap-dev] HGT - getElevation()

2018-01-09 Thread Andrzej Popowski
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

Re: [mkgmap-dev] HGT - getElevation()

2018-01-09 Thread Gerd Petermann
5 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] HGT - getElevation() Hi, correction - these values never are negative? -- Best regards, Andrzej ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/lis

Re: [mkgmap-dev] HGT - getElevation()

2018-01-09 Thread Andrzej Popowski
Hi, correction - these values never are negative? -- Best regards, Andrzej ___ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

[mkgmap-dev] HGT - getElevation()

2018-01-09 Thread Andrzej Popowski
Hi, I have looked at code and get some doubts. File HGTConverter.java, function getElevation(). Shouldn't conversion double -> int use Math.floor? I mean these lines: int row = (int) ((lat32 - minLat32) * FACTOR); int col = (int) ((lon32 - minLon32) * FACTOR); int xLeft = (int) x1; int