lambertgo

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2016 License: BSD-2-Clause Imports: 2 Imported by: 0

README

Build Status GoDoc Report Cart

Description

A simple Go package to convert coordinates in Lambert projections system to GPS WGS84 coordinates. It is based on the IGN algorithms and methods

Install

go get gopkg.in/yageek/lambertgo.v1

Usage

import lgo "github.com/yageek/lambertgo"
import "fmt"

//Declares origin point and translated point
var point *lgo.Point= &lgo.Point{994272.661,113467.422,0,lgo.Meter}

//Converts pointOrg in Lambert Zone 1 to WGS84 - Results in Radian
point.ToWGS84(lgo.LambertI)

//Converts to Degree
point.ToDegree()

fmt.Printf("Latitude:%.5f - Longitude:%.5f",point.Y,point.X)

Documentation

Overview

Package lambertgo helps to transform coordinates from Lambert system into the WGS84 system.

Index

Examples

Constants

View Source
const (
	// LambertI represents the first Lambert zone.
	LambertI = 0
	// LambertII represents the second Lambert zone.
	LambertII = 1
	// LambertIII represents the third Lambert zone.
	LambertIII = 2
	// LambertIV represents the fourth Lambert zone.
	LambertIV = 3
	// LambertIIE represents the extended lambert zone.
	LambertIIE = 4
	// Lambert93 represents the lambert 93 zone.
	Lambert93 = 5
)
View Source
const (
	// Degree represents standart degrees unit.
	Degree = iota
	// Grad represents standart grad unit.
	Grad = iota
	// Radian represents standart radian unit.
	Radian = iota
	// Meter represents standart meter unit.
	Meter = iota

	//EClarkIGN represents the E value from Clark ellipsoïd.
	EClarkIGN float64 = 0.08248325676
	//EWGS84 represents the E value from WGS84 ellipsoïd.
	EWGS84 float64 = 0.08181919106

	//AClarkIGN represents the A value from Clark ellipsoïd.
	AClarkIGN float64 = 6378249.2

	//AWGS84 represents the A value from WGS84 ellipsoïd.
	AWGS84 float64 = 6378137.0

	//ParisLongitudeMeridian is the Paris's meridian longitude in radian.
	ParisLongitudeMeridian float64 = 0
	//GreenwichLongitudeMeridian is the Greenwich's meridian longitude in radian.
	GreenwichLongitudeMeridian float64 = 0.04079234433
	//IERSLongitudeMeridian is the IERS's meridian longitude in radian.
	IERSLongitudeMeridian float64 = 3 * math.Pi / 180.0
)

Variables

View Source
var DefaultEPS = 1e-10

DefaultEPS is the comparison margin used in the different algorithms.

Functions

This section is empty.

Types

type Point

type Point struct {
	X    float64
	Y    float64
	Z    float64
	Unit int32
}

Point represents a generic point with three space coordinates and unit.

func (*Point) ToDegree

func (pt *Point) ToDegree()

ToDegree converts the coordinates from Radian or Grad to Degree.

func (*Point) ToGrad

func (pt *Point) ToGrad()

ToGrad converts the coordinates from Degree or Radian to Degree.

func (*Point) ToRadian

func (pt *Point) ToRadian()

ToRadian converts the coordinates from Degree or Grad to Degree.

func (*Point) ToWGS84

func (pt *Point) ToWGS84(zone Zone)

ToWGS84 converts coordinates expressed in Meter in the lambert system to Radian in the WGS84 system. It takes the lambert Zone ine parameters.

Example
var point = &Point{668832.5384, 6950138.7285, 0, Meter}
point.ToWGS84(Lambert93)
fmt.Printf("Latitude:%5f - Longitude:%.5f", point.Y, point.X)
Output:

Latitude:0.866549 - Longitude:0.04483

type Zone

type Zone int32

Zone represents the different lambert zones.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL