Skip to content

gden173/geotiff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Geotiff

Go Reference main main ci status codecov

A golang geotiff parsing library. This is a pure golang implementation with no dependencies on gdal or C compilation. This is meant to implement a relatively small subset of gdal. However, more features may be implemented in the future.

Installation

go get github.com/gden173/geotiff@latest

Command Line Example

The command line tool geotiff can be used to read in a geotiff file and print details about the geotiff file.

go build -o geotiff cmd/geotiff/main.go
./geotiff -info geotiff/testdata/WCSServer.tif

# GeoTiff Info
# Bounds:
# Upper Left   ( 135.0000000,  -20.0000000 )
# Lower Left   ( 135.0000000,  -25.3000000 )
# Upper Right  ( 140.0000000,  -20.0000000 )
# Lower Right  ( 140.0000000,  -25.3000000 )
#
# Stats:
# Minimum=46.557, Maximum=942.159, Mean=234.397, StdDev=106.603

Library Example

An example of reading in a tiled geotiff is located in the main.go file.

package main

import (
	"fmt"
	"os"

	"github.com/gden173/geotiff/geotiff"
)

func main() {
	f, err := os.Open("geotiff/testdata/WCSServer.tif")
	if err != nil {
		panic(err)
	}
	defer f.Close()

	// read the geotiff
	gtiff, err := geotiff.Read(f)
    if err != nil {
        panic(err)
    }

	// get the geotiff bounds
	bounds, err := gtiff.Bounds()
	if err != nil {
		panic(err)
	}
	fmt.Println(bounds)
}

// Upper Left   ( 114.0000000,  -11.0000000 )
// Lower Left   ( 114.0000000,  -44.0000000 )
// Upper Right  ( 153.9000000,  -11.0000000 )
// Lower Right  ( 153.9000000,  -44.0000000 )

Licence

About

A pure golang implementation of a geotiff parser.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages