Reading data from GeoTIFF with the gdal package

101 views
Skip to first unread message

Rick Walters

unread,
Oct 26, 2022, 3:37:24 PM10/26/22
to golang-nuts
Hi, if anyone has any experience with Luke Roth's gdal package… I'm relatively new to Go, and very new to GeoTIFF and GDAL, and struggling a bit.

I'm trying to read data from a 32-bit float band of a GeoTIFF (representing elevation) and have two questions:

  1. Is there any way to directly access the very useful values returned by `gdal.Info(sourceDS Dataset, options []string)`? Do I have to parse the resulting string myself? Does the `options []string` argument do something that might be of use to me?
  2. I can get as far as having a Go variable referencing the RasterBand I'm interested in, and everything I can examine about it checks out, but I'm stumped at how to extract the data from the band. The closest  I can figure is the `RasterBand.ReadBlock(…)` method, but can't figure out how to use it… admittedly, it seems to require the use of an `unsafe.Pointer` and I don't really understand those. Any guidance, documentation, gists, etc. that might help me out would be very much appreciated!

Thanks!
Reply all
Reply to author
Forward
0 new messages