suggestion: parser returns absolute coordinates of each height
It's kinda tricky to do the mapping of row / columns to coordinates. It could be a useful feature.
@Vichoko : Sorry I don't understand what you mean. Can you provide an example or give more detail ?
I were confused by the square corners, as i imagined the hgt file contained punctual heights not a tiling of the surface.
Now i see that the iterator include the square corners coordinates, and with that i can get the coordinates of each cell by getting the mean of the corners or subtracting 1/2400 to the top-right corner.
(i'm trying to export the hgt files to a more flexible data structure)
I think for indexing it is useful and lighter to retrieve the coordinate of the center of the square instead of the corners (1 value versus 4 values) In the case of this library, getting the center is a matter of substracting 1/2400 to the top-right corner of each cell.
Indeed, you are right, it would be more like only : lat of the center, lng of the center and another global one for the whole file which is the size of a square.
But the intended use case of this library was with PostGIS and its raster format which needs the 4 coordinates of a square. And with the rounding issue (it took me a few hours to find a solution without errors), I did not want to have somebody else with the same problem.
If needed, we could imagine something like this:
>>> with HgtParser('/tmp/N00E010.hgt') as parser:
... for elev_value in parser.get_value_iterator(square_mode=False):
... # each value is a tuple (zero based line number, zero based column number, zero based index, (center coordinates, square width), elevation value)
... print(elev_value)
... break
...
(0, 0, 0, ((0.9995833333333334, 9.999583333333334), 0.83333333333334), 57)