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...
Remaphore - Admin tool employing NATS to coordinate processes on distributed infrastructure.

remaphore Admin tool employing NATS to coordinate processes on distributed infrastructure. Tasks on widely distributed machines often have to be coord

Natural language detection package in pure Go

getlang getlang provides fast natural language detection in Go. Features Offline -- no internet connection required Supports 29 languages Provides ISO

Package git provides an incomplete pure Go implementation of Git core methods.

git Package git provides an incomplete pure Go implementation of Git core methods. Example Code: store := git.TempStore() defer os.RemoveAll(string(st

Pure Go line editor with history, inspired by linenoise

Liner Liner is a command line editor with history. It was inspired by linenoise; everything Unix-like is a VT100 (or is trying very hard to be). If yo

Pure Go termbox implementation

IMPORTANT This library is somewhat not maintained anymore. But I'm glad that it did what I wanted the most. It moved people away from "ncurses" mindse

LZ4 compression and decompression in pure Go

lz4 : LZ4 compression in pure Go Overview This package provides a streaming interface to LZ4 data streams as well as low level compress and uncompress

The minilock file encryption system, ported to pure Golang. Includes CLI utilities.
The minilock file encryption system, ported to pure Golang. Includes CLI utilities.

Go-miniLock A pure-Go reimplementation of the miniLock asymmetric encryption system. by Cathal Garvey, Copyright Oct. 2015, proudly licensed under the

A simple, fast, embeddable, persistent key/value store written in pure Go. It supports fully serializable transactions and many data structures such as list, set, sorted set.

NutsDB English | 简体中文 NutsDB is a simple, fast, embeddable and persistent key/value store written in pure Go. It supports fully serializable transacti

Low-level key/value store in pure Go.
Low-level key/value store in pure Go.

Description Package slowpoke is a simple key/value store written using Go's standard library only. Keys are stored in memory (with persistence), value

Pure Go Postgres driver for database/sql

pq - A pure Go postgres driver for Go's database/sql package Install go get github.com/lib/pq Features SSL Handles bad connections for database/sql S

SQLite with pure Go

Sqinn-Go is a Go (Golang) library for accessing SQLite databases in pure Go. It uses Sqinn https://github.com/cvilsmeier/sqinn under the hood. It star

Fast, efficient, and scalable distributed map/reduce system, DAG execution, in memory or on disk, written in pure Go, runs standalone or distributedly.

Gleam Gleam is a high performance and efficient distributed execution system, and also simple, generic, flexible and easy to customize. Gleam is built

Glow is an easy-to-use distributed computation system written in Go, similar to Hadoop Map Reduce, Spark, Flink, Storm, etc. I am also working on another similar pure Go system, https://github.com/chrislusf/gleam , which is more flexible and more performant. The pure golang implementation of nanomsg (version 1, frozen)
The pure golang implementation of nanomsg (version 1, frozen)

mangos NOTE: This is the legacy version of mangos (v1). Users are encouraged to use mangos v2 instead if possible. No further development is taking pl

gide is an IDE framework in pure Go, using the GoGi gui.  It extensively adopts emacs keybindings.
gide is an IDE framework in pure Go, using the GoGi gui. It extensively adopts emacs keybindings.

Gide Gide is a flexible IDE (integrated development environment) framework in pure Go, using the GoGi GUI (for which it serves as a continuous testing

ECMAScript/JavaScript engine in pure Go

Goja is an implementation of ECMAScript 5.1 in pure Go with emphasis on standard compliance and performance.

Implements the XDR standard as specified in RFC 4506 in pure Go (Golang)

go-xdr [] (https://travis-ci.org/davecgh/go-xdr) [![Coverage Status] (https://coveralls.io/repos/davecgh/go-xdr/badge.png?branch=master)] (https://cov

A pure Go game engine
A pure Go game engine

Oak A pure Go game engine Table of Contents Installation Motivation Features Support Quick Start Implementation and Examples Finished Games Installati

Simple ANSi to PNG converter written in pure Go

AnsiGo Description AnsiGo is a simple ANSi to PNG converter written in pure Go. It converts files containing ANSi sequences (.ANS) into PNG images. Fo

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
Package geom implements efficient geometry types for geospatial applications.

go-geom Package geom implements efficient geometry types for geospatial applications. Key features OpenGeo Consortium-style geometries. Support for 2D

Tom Payne 645 Jan 6, 2023
Package kml provides convenince methods for creating and writing KML documents.

go-kml Package kml provides convenience methods for creating and writing KML documents. Key Features Simple API for building arbitrarily complex KML d

Tom Payne 66 Jul 29, 2022
Package polyline implements a Google Maps Encoding Polyline encoder and decoder.

go-polyline Package polyline implements a Google Maps Encoding Polyline encoder and decoder. Encoding example func ExampleEncodeCoords() { coords :=

Tom Payne 79 Dec 1, 2022
yet another point in polygon package

piper Yet another point in polygon package. Piper makes use of ray casting and does account for holes in polygons. Installation go get -u github.com/i

Ben 12 Oct 17, 2022
A pure Go package for coordinate transformations.

WGS84 A pure Go package for coordinate transformations. go get github.com/wroge/wgs84 Usage east, north, h := wgs84.LonLat().To(wgs84.ETRS89UTM(32)).R

Malte Wrogemann 93 Nov 25, 2022
Package core is a service container that elegantly bootstrap and coordinate twelve-factor apps in Go.

Package core is a service container that elegantly bootstrap and coordinate twelve-factor apps in Go. Background The twelve-factor methodology has pro

DoNews 55 Nov 3, 2022
Arbitrary transformations of JSON in Golang

kazaam Description Kazaam was created with the goal of supporting easy and fast transformations of JSON data with Golang. This functionality provides

Qntfy 245 Dec 18, 2022
Kazaam was created with the goal of supporting easy and fast transformations of JSON data with Golang

kazaam Description Kazaam was created with the goal of supporting easy and fast transformations of JSON data with Golang. This functionality provides

Qntfy 205 Sep 17, 2021
Golang k-d tree implementation with duplicate coordinate support

Golang k-d tree implementation with duplicate coordinate support

DownFlux 46 Nov 9, 2022
Transformations for 2D and 3D(maybe)

barnacle The Name What a name right? When creating this repo Github showed overland-barnacle. Just had to use barnacle! What is it? Transformations fo

Bill Jones 0 Dec 28, 2021