func Read(fname string, bytes []byte) (sw *LatLng, squareSize int, elevations []int16, err error) {
	if len(bytes) == 12967201*2 {
		// 1 arcsecond
		squareSize = 3601
	} else if len(bytes) == 1442401*2 {
		// 3 arcseconds
		squareSize = 1201
	} else {
		return sw, squareSize, elevations, fmt.Errorf("hgt file cannot identified (only 1 arcsecond and 3 arcsecond supported, file size = %d)", len(bytes))
	}

	sw, err = southWest(fname)
	if err != nil {
		return sw, squareSize, elevations, errors.Wrap(err, "could not get corner coordinates from file name")
	}

	elevations = make([]int16, squareSize*squareSize)

	// Latitude
	for row := 0; row < squareSize; row++ {
		// Longitude
		for col := 0; col < squareSize; col++ {
			idx := row*squareSize + col
			elevations[idx] = int16(binary.BigEndian.Uint16(bytes[idx*2 : idx*2+2]))
		}
	}

	return sw, squareSize, elevations, nil
}
// Read reads elevation for points from a SRTM file
Read reads elevation for points from a SRTM file
// Read reads elevation for points from a SRTM file
func Read(fname string, bytes []byte) (sw *LatLng, squareSize int, elevations []int16, err error) {
	if len(bytes) == 12967201*2 {
		squareSize = 3601
	} else if len(bytes) == 1442401*2 {
		squareSize = 1201
	} else {
		return sw, squareSize, elevations, fmt.Errorf("hgt file cannot identified (only 1 arcsecond and 3 arcsecond supported, file size = %d)", len(bytes))
	}
	sw, err = southWest(fname)
	if err != nil {
		return sw, squareSize, elevations, errors.Wrap(err, "could not get corner coordinates from file name")
	}
	elevations = make([]int16, squareSize*squareSize)
	for row := 0; row < squareSize; row++ {
		for col := 0; col < squareSize; col++ {
			idx := row*squareSize + col
			elevations[idx] = int16(binary.BigEndian.Uint16(bytes[idx*2 : idx*2+2]))
		}
	}
	return sw, squareSize, elevations, nil
}
func Read ( fname string , bytes [ ] byte ) ( sw * LatLng , squareSize int , elevations [ ] int16 , err error ) { if len ( bytes ) == 12967201 * 2 { squareSize = 3601 } else if len ( bytes ) == 1442401 * 2 { squareSize = 1201 } else { return sw , squareSize , elevations , fmt . Errorf ( " " , len ( bytes ) ) } sw , err = southWest ( fname ) if err != nil { return sw , squareSize , elevations , errors . Wrap ( err , " " ) } elevations = make ( [ ] int16 , squareSize * squareSize ) for row := 0 ; row < squareSize ; row ++ { for col := 0 ; col < squareSize ; col ++ { idx := row * squareSize + col elevations [ idx ] = int16 ( binary . BigEndian . Uint16 ( bytes [ idx * 2 : idx * 2 + 2 ] ) ) } } return sw , squareSize , elevations , nil }
Read reads elevation for points from a SRTM file
Read reads elevation for points from a SRTM file
// 1 arcsecond // 3 arcseconds // Latitude // Longitude