A pure Go package for coordinate transformations.

Overview

Build Status go.dev reference Go Report Card golangci-lint Codecov GitHub tag (latest SemVer)

WGS84

A pure Go package for coordinate transformations.

go get github.com/wroge/wgs84

Usage

east, north, h := wgs84.LonLat().To(wgs84.ETRS89UTM(32)).Round(2)(9, 52, 0)
// 500000 5.76103821e+06 0

east, north, h := wgs84.To(wgs84.WebMercator())(9, 52, 0)
// 1.0018754171394621e+06 6.800125454397305e+06 -9.313225746154785e-10

epsg := wgs84.EPSG()

lon, lat, h := wgs84.ETRS89UTM(32).To(epsg.Code(4326)).Round(3)(500150, 5761200, 0)
// 9.002 52.001 0

// EPSG-Codes covering the coordinate {longitude: 9, latitude: 52}:
codes := epsg.CodesCover(9, 52)
// [25832 4314 32632 4978 4258 31467 4326 3857 900913]

...Calculate EPSG-Code from Unknown Coordinates
...Calculate WebMercator Tile from WGS84 Longitude Latitude
...Transformation between OSGB36 NationalGrid and WGS84 Geographic Coordinates
...Adding a CoordinateReferenceSystem (MGI AustriaLambert) to the EPSG-Repository

Features

  • Helmert Transformation
  • Web Mercator
  • Lambert Conformal Conic
  • Transverse Mercator (UTM)
  • EPSG-Code Coverage
  • ...
  • Easily expandable through simple Interfaces
You might also like...
Imaging is a simple image processing package for Go
Imaging is a simple image processing package for Go

Imaging Package imaging provides basic image processing functions (resize, rotate, crop, brightness/contrast adjustments, etc.). All the image process

Go package for decoding and encoding TARGA image format

tga tga is a Go package for decoding and encoding TARGA image format. It supports RLE and raw TARGA images with 8/15/16/24/32 bits per pixel, monochro

Go package for computer vision using OpenCV 4 and beyond.
Go package for computer vision using OpenCV 4 and beyond.

GoCV The GoCV package provides Go language bindings for the OpenCV 4 computer vision library. The GoCV package supports the latest releases of Go and

Go Perceptual image hashing package

goimagehash Inspired by imagehash A image hashing library written in Go. ImageHash supports: Average hashing Difference hashing Perception hashing Wav

generativeart is a Go package to generate many kinds of generative art.
generativeart is a Go package to generate many kinds of generative art.

generativeart is a Go package to generate many kinds of generative art. The goal is to collect some excellent generative art (implemented in R or Processing), and rewrite them in Go again

golang package to find the K most dominant/prominent colors in an image
golang package to find the K most dominant/prominent colors in an image

prominentcolor Find the K most dominant colors in an image The Kmeans function returns the K most dominant colors in the image, ordered in the order o

Go package captcha implements generation and verification of image and audio CAPTCHAs.
Go package captcha implements generation and verification of image and audio CAPTCHAs.

Package captcha ⚠️ Warning: this captcha can be broken by advanced OCR captcha breaking algorithms. import "github.com/dchest/captcha" Package captch

openGL Have Fun - A Go package that makes life with OpenGL enjoyable.

glhf openGL Have Fun - A Go package that makes life with OpenGL enjoyable. go get github.com/faiface/glhf Main features Garbage collected OpenGL obje

p5 is a simple package that provides primitives resembling the ones exposed by p5js.org
p5 is a simple package that provides primitives resembling the ones exposed by p5js.org

p5 p5 is a simple package that provides primitives resembling the ones exposed by the p5/processing library. License p5 is released under the BSD-3 li

Comments
  • transform result accuracy

    transform result accuracy

    Here's my code

    type spheroid struct {
    	a, fi float64
    }
    
    func (s spheroid) A() float64 {
    	return s.a
    }
    
    func (s spheroid) Fi() float64 {
    	return s.fi
    }
    
    func main() {
    	test := wgs84.Datum{
    		Spheroid: spheroid{
    			a:  6378137,
    			fi: 298.257222101,
    		},
    		Area: wgs84.AreaFunc(func(lon, lat float64) bool {
    			if lon < 118.5 || lon > 121.5 || lat < 24.43 || lat > 53.33 {
    				return false
    			}
    			return true
    		}),
    	}
    
    	proj := test.TransverseMercator(120, 0, 1, 500000, 0)
    
    	epsg := wgs84.EPSG()
    	epsg.Add(4549, proj)
    
    	transform := wgs84.Transform(epsg.Code(4549), wgs84.LonLat())
    	f1, f2, f3 := transform(478077, 4025869, 0)
    	fmt.Println(f1, f2, f3)
    
    }
    

    wkt for epsg:4549

    PROJCS["CGCS2000 / 3-degree Gauss-Kruger CM 120E",
        GEOGCS["China Geodetic Coordinate System 2000",
            DATUM["China_2000",
                SPHEROID["CGCS2000",6378137,298.257222101,
                    AUTHORITY["EPSG","1024"]],
                AUTHORITY["EPSG","1043"]],
            PRIMEM["Greenwich",0,
                AUTHORITY["EPSG","8901"]],
            UNIT["degree",0.0174532925199433,
                AUTHORITY["EPSG","9122"]],
            AUTHORITY["EPSG","4490"]],
        PROJECTION["Transverse_Mercator"],
        PARAMETER["latitude_of_origin",0],
        PARAMETER["central_meridian",120],
        PARAMETER["scale_factor",1],
        PARAMETER["false_easting",500000],
        PARAMETER["false_northing",0],
        UNIT["metre",1,
            AUTHORITY["EPSG","9001"]],
        AUTHORITY["EPSG","4549"]]
    

    With my code I got result is [119.75572865201768, 36.36317346481494, -3.6767683923244476e-05] But What I got form epsg.io was [119.7557287, 36.3631738], and from gdaltransform was [119.755728654111, 36.3631737608256, 0]

    So I am wandering what makes these differences? Is there any problems?

    opened by zbml 3
Owner
Malte Wrogemann
Malte Wrogemann
Image processing algorithms in pure Go

bild A collection of parallel image processing algorithms in pure Go. The aim of this project is simplicity in use and development over absolute high

Anthony N. Simon 3.7k Jan 6, 2023
Pure golang image resizing

This package is no longer being updated! Please look for alternatives if that bothers you. Resize Image resizing for the Go programming language with

Jan Schlicht 2.9k Jan 9, 2023
Rich TIFF/BigTIFF/GeoTIFF decoder/encoder for Go (Pure Go/Zero Dependencies)

Go语言QQ群: 102319854, 1055927514 凹语言(凹读音“Wa”)(The Wa Programming Language): https://github.com/wa-lang/wa TIFF for Go Features: Support BigTiff Support

chai2010 45 Nov 16, 2022
Image resizing in pure Go and SIMD

rez Package rez provides image resizing in pure Go and SIMD. Download: go get github.com/bamiaux/rez Full documentation at http://godoc.org/github.com

Benoît Amiaux 208 Dec 11, 2022
Pure Golang Library that allows simple LSB steganography on images

Steganography Lib Steganography is a library written in Pure go to allow simple LSB steganography on images. It is capable of both encoding and decodi

Rafael Passos 176 Dec 22, 2022
A pure Go 3D math library.

MathGL This is a Go matrix and vector math library specialized for Open GL graphics capabilities. This package is made primarily with code generation

OpenGL with Golang 466 Dec 24, 2022
NanoVGo NanoVGNanoVGo is pure golang implementation of NanoVG. The same author maintains the NanoGUI.go project mentioned above.

NanoVGo Pure golang implementation of NanoVG. NanoVG is a vector graphics engine inspired by HTML5 Canvas API. DEMO API Reference See GoDoc Porting Me

Yoshiki Shibukawa 143 Dec 6, 2022
Pure Go encoder/decoder of the QOI image format

QOI - The “Quite OK Image” format for fast, lossless image compression package and small utilities in native Go, quite OK implementation See qoi.h for

Xavier-Frédéric Moulet 58 Nov 12, 2022
Go package for fast high-level image processing powered by libvips C library

bimg Small Go package for fast high-level image processing using libvips via C bindings, providing a simple programmatic API. bimg was designed to be

Tom 2.1k Jan 2, 2023
Go bindings for GStreamer (retired: currently I don't use/develop this package)

Retired. I don't use/develop this package anymore. Go bindings for GStreamer at a very early stage of maturity. This package is based on GLib bindings

Michał Derkacz 166 Nov 10, 2022