Documentation
¶
Index ¶
- Constants
- Variables
- func CoordinatesToIndex(point image.Point, format SRTMFormat) (int, error)
- func IndexToCoordinates(index int, format SRTMFormat) (image.Point, error)
- func IsIndexInBounds(index int, format SRTMFormat) bool
- func IsPointInBounds(point image.Point, format SRTMFormat) bool
- type SRTMFormat
- type SRTMImage
- func (srtmImg *SRTMImage) ElevationAt(point image.Point) (int16, error)
- func (srtmImg *SRTMImage) ElevationMean() int16
- func (srtmImg *SRTMImage) ElevationMinMax() (min int16, max int16)
- func (srtmImg *SRTMImage) ElevationPercentile(percentile float64) int16
- func (srtmImg *SRTMImage) ElevationVoids() []image.Point
- func (srtmImg *SRTMImage) FullImage() *image.Gray16
- func (srtmImg *SRTMImage) HeightCenteredImage(height int16) *image.Gray
- func (srtmImg *SRTMImage) MeanCenteredImage() *image.Gray
- func (srtmImg *SRTMImage) ScaledHeightImage(factor, centerHeight int16) *image.Gray
Constants ¶
const ( SRTM1Format = SRTMFormat(iota) SRTM3Format )
const ( SRTM1Size = 3601 SRTM3Size = 1201 )
Variables ¶
var ErrIndexOutOfBounds = errors.New("index out of bounds for SRTM image format")
var ErrPointOutOfBounds = errors.New("point out of bounds for SRTM image format")
var SRTMByteOrder = binary.BigEndian
Functions ¶
func CoordinatesToIndex ¶
func CoordinatesToIndex(point image.Point, format SRTMFormat) (int, error)
CoordinatesToIndex converts x,y coordinates to an index into the data array for the given SRTMFormat.
func IndexToCoordinates ¶
func IndexToCoordinates(index int, format SRTMFormat) (image.Point, error)
IndexToCoordinates converts an index into the data array of a SRTMImage with the given format to x,y coordinates.
func IsIndexInBounds ¶
func IsIndexInBounds(index int, format SRTMFormat) bool
IsIndexInBounds returns true if the given index is inside the data array of the given SRTMFormat.
func IsPointInBounds ¶
func IsPointInBounds(point image.Point, format SRTMFormat) bool
IsPointInBounds checks if the given point is inside the data array of the given SRTMFormat.
Types ¶
type SRTMFormat ¶
type SRTMFormat int
func (SRTMFormat) Size ¶
func (f SRTMFormat) Size() int
func (SRTMFormat) String ¶
func (f SRTMFormat) String() string
type SRTMImage ¶
type SRTMImage struct { Data []int16 Format SRTMFormat }
func NewSRTMImage ¶
func NewSRTMImage(r io.Reader, format SRTMFormat) (*SRTMImage, error)
func (*SRTMImage) ElevationAt ¶
ElevationAt returns the elevation value at the given coordinates.
func (*SRTMImage) ElevationMean ¶
ElevationMean returns the mean elevation value. Overflows as well as voids are mitigated. Thus may not be the actual mean.
func (*SRTMImage) ElevationMinMax ¶
ElevationMinMax returns the minimum and maximum elevation values. Data voids are ignored and not interpreted as minimum. Values may be erroneous, because of other invalid data.
func (*SRTMImage) ElevationPercentile ¶
ElevationPercentile returns the nearest-ranked percentile of the elevation values. Percentile must be between 0 and 1. Data voids are not ignored and part of the percentile calculation.
func (*SRTMImage) ElevationVoids ¶
DataVoidIndices returns points of all voids in the srtmImage. Data voids are represented by the value -32768 as per the SRTM documentation.
func (*SRTMImage) FullImage ¶
FullImage returns the full data range as a 16 bit-depth grayscale image. This preserves the original data completely and allows for further processing.
Please note that some image viewers are not able to display 16 bit images. In many cases, the image will be displayed as a 8 bit image or will be displayed incorrectly.
func (*SRTMImage) HeightCenteredImage ¶
HeightCenteredImage centeres the elevation data to the provided elevation value. No scaling is applied. The center value corresponds to the value of 128 in the resulting image. Smaller values are darker, larger values are brighter. If there are values too large or too small, these values will be set to white or black, respectively. Values may be erroneous, because of voids or other invalid data.
func (*SRTMImage) MeanCenteredImage ¶
MeanCenteredImage centeres the elevation data to the mean elevation value. No scaling is applied. The calculated mean value corresponds to the value of 128 in the resulting image. Smaller values are darker, larger values are brighter. If there are values too large or too small, these values will be set to white or black, respectively. Values may be erroneous, because of voids or other invalid data.
func (*SRTMImage) ScaledHeightImage ¶
ScaledHeightImage returns a grayscale image with the elevation data scaled to the provided factor. The factor determines how many meters are represented by one brightness value. The center height determines the elevation value that corresponds to the brightness value of 128.