Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hemisphere ¶
type Hemisphere byte
Hemisphere represents the hemisphere, north or south
const ( HemisphereInvalid Hemisphere = iota HemisphereNorth HemisphereSouth )
Hemisphere constants
type MGRS ¶
type MGRS struct {
// contains filtered or unexported fields
}
MGRS is an coordinate converter to and from MGRS coordinates.
var DefaultMGRSConverter *MGRS
DefaultMGRSConverter is a WGS84 ellipsoid based MGRS converter.
func NewMGRS ¶
func NewMGRS(ellipsoidSemiMajorAxis, ellipsoidFlattening float64, ellipsoidCode string) (*MGRS, error)
NewMGRS constructs an MGRS converter with ellipsoid parameters.
func (*MGRS) ConvertFromGeodetic ¶
ConvertFromGeodetic converts Geodetic (latitude and longitude) coordinates to an MGRS coordinate string, according to the current ellipsoid parameters.
Example ¶
package main import ( "fmt" "github.com/golang/geo/s2" "github.com/tzneal/coordconv" ) func main() { mgrs, _ := coordconv.DefaultMGRSConverter.ConvertFromGeodetic(s2.LatLngFromDegrees(0, 0), 5) fmt.Println(mgrs) }
Output: 31NAA6602100000
func (*MGRS) ConvertFromUTM ¶
ConvertFromUTM converts UTM (zone, easting, and northing) coordinates to an MGRS coordinate string, according to the current ellipsoid parameters. If any errors occur, an exception is thrown with a description of the error.
func (*MGRS) ConvertToGeodetic ¶
ConvertToGeodetic converts an MGRS coordinate string to Geodetic (latitude and longitude) coordinates according to the current ellipsoid parameters.
Example ¶
package main import ( "fmt" "github.com/tzneal/coordconv" ) func main() { geo, _ := coordconv.DefaultMGRSConverter.ConvertToGeodetic("16SGC3855124838") fmt.Println(geo) }
Output: [33.6366624, -84.4280571]
type PolarStereographic ¶
type PolarStereographic struct {
// contains filtered or unexported fields
}
PolarStereographic provides conversions between geodetic (latitude and longitude) coordinates and Polar Stereographic (easting and northing) coordinates.
func NewPolarStereographic ¶ added in v0.1.2
func NewPolarStereographic(ellipsoidSemiMajorAxis, ellipsoidFlattening, centralMeridian, standardParallel, falseEasting, falseNorthing float64) (*PolarStereographic, error)
NewPolarStereographic receives the ellipsoid parameters and Polar Stereograpic (Standard Parallel) projection parameters as inputs, and sets the corresponding state variables.
func NewPolarStereographicScaleFactor ¶ added in v0.1.2
func NewPolarStereographicScaleFactor(ellipsoidSemiMajorAxis, ellipsoidFlattening, centralMeridian, scaleFactor float64, hemisphere Hemisphere, falseEasting, falseNorthing float64) (*PolarStereographic, error)
NewPolarStereographicScaleFactor ellipsoid parameters and Polar Stereograpic (Scale Factor) projection parameters as inputs, and sets the corresponding state variables.
func (*PolarStereographic) ConvertFromGeodetic ¶
func (p *PolarStereographic) ConvertFromGeodetic(geodeticCoordinates s2.LatLng) (MapCoords, error)
ConvertFromGeodetic converts geodetic coordinates (latitude and longitude) to Polar Stereographic coordinates (easting and northing), according to the current ellipsoid and Polar Stereographic projection parameters.
func (*PolarStereographic) ConvertToGeodetic ¶
func (p *PolarStereographic) ConvertToGeodetic(mapProjectionCoordinates MapCoords) (s2.LatLng, error)
ConvertToGeodetic converts Polar Stereographic coordinates (easting and northing) to geodetic coordinates (latitude and longitude) according to the current ellipsoid and Polar Stereographic projection Parameters.
type TransverseMercator ¶
type TransverseMercator struct { TranMercFalseNorthing float64 // False northing in meters // contains filtered or unexported fields }
TransverseMercator provides conversions between Geodetic coordinates (latitude and longitude) and Transverse Mercator projection coordinates (easting and northing).
func NewTransverseMercator ¶
func NewTransverseMercator(ellipsoidSemiMajorAxis, ellipsoidFlattening, centralMeridian, latitudeOfTrueScale, falseEasting, falseNorthing, scaleFactor float64, ellipsoidCode string) (*TransverseMercator, error)
NewTransverseMercator constructs a new TransverseMercator converter.
type UPS ¶
type UPS struct { UPSOriginLatitude float64 // contains filtered or unexported fields }
UPS is a UPS coordinate converter
var DefaultUPSConverter *UPS
DefaultUPSConverter is a WGS84 ellipsoid based UPS converter.
func (*UPS) ConvertFromGeodetic ¶
ConvertFromGeodetic converts a geodetic coordinate to a UPS coordinate.
type UPSCoord ¶
type UPSCoord struct { Hemisphere Hemisphere Easting float64 Northing float64 }
UPSCoord is a UPS coordinate with a specified easting/northing in meters and hemisphere.
type UTM ¶
type UTM struct {
// contains filtered or unexported fields
}
UTM is a UTM coordinate converter
var DefaultUTMConverter *UTM
DefaultUTMConverter is a WGS84 ellipsoid based UTM converter.
func NewUTM2 ¶
func NewUTM2(ellipsoidSemiMajorAxis, ellipsoidFlattening float64, ellipsoidCode string, override int) (*UTM, error)
NewUTM2 receives the ellipsoid parameters and UTM zone override parameter as inputs, and sets the corresponding state variables. override is the UTM override zone, 0 indicates no override.
func (*UTM) ConvertFromGeodetic ¶
func (u *UTM) ConvertFromGeodetic(geodeticCoordinates s2.LatLng, utmZoneOverride int) (UTMCoord, error)
ConvertFromGeodetic converts geodetic (latitude and longitude) coordinates to UTM projection (zone, hemisphere, easting and northing) coordinates according to the current ellipsoid and UTM zone override parameters.