tasgrid

package module
v0.0.0-...-4f77be0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

README

tasgrid

Golang library to calculate full UTM grid reference for Tasmanian 6-figure grid references

Many Tasmanian agencies and research organisations have traditionally geocoded biological observations using a map name and 6-figure grid reference. The Tasmanian Herbarium uses a three-letter code to designate a 1:100,000-series map (for example, HUO for Huon), and the following 6 figures to designate the point location within a 50 m radius.

The full UTM grid reference can be calculated from the map code and 6-figure grid reference, and latitude and longitude derived from this:

  • Most of Tasmania falls within UTM Zone 55 G, simplifying calculations.
  • The missing coordinates from the grid reference easting and northing can be calculated using the starting points written in each map

Base data

The file mapinfo.csv contains a matrix of map names, zone, zone alpha, as well as the lowest easting and northing coordinates for each map.

Usage

go get github.com/kurankat/tasgrid

Create a MapGrid object to hold the necessary data for each map by calling NewTasMapGrid(). MapGrid is a map of TasMap objects, with the map's name as the index.

var fullGrid = *tasgrid.NewTasMapGrid()

You can then call NewGridPoint to generate a grid point with all its spatial information, and call its methods.

gridPoint, err = tasgrid.NewGridPoint(mapname, easting, northing, fullGrid)

To retrieve a point's full-length easting or northing (as zone 55 G) as a string:

gridPoint.GetFullEasting()

gridPoint.GetFullNorthing()

To retrieve a point's decimal latitude and longitude as strings:

gridPoint.GetDecimalLat()

gridPoint.GetDecimalLong()

To retrieve a point's latitude and longitude seconds as strings:

gridPoint.GetLatSeconds()

gridPoint.GetLongSeconds()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GridPoint

type GridPoint struct {
	MapName string
	// contains filtered or unexported fields
}

GridPoint holds all the necessary information pertaining to a grid point, calculated from the name of the map provided and the three-figure easting and northing

func NewGridPoint

func NewGridPoint(name, textEasting, textNorthing string, mg MapGrid) (GridPoint, error)

NewGridPoint creates a GridPoint from the supplied map name and 3-digit easting and northing, and calculates the full easting and northing, as well as the latitude and longitude of the record in decimal degrees and degrees, minutes and seconds

func (GridPoint) GetDecimalLat

func (gp GridPoint) GetDecimalLat() (dLat string)

GetDecimalLat returns the latitude in decimal degrees of the grid point as a string

func (GridPoint) GetDecimalLong

func (gp GridPoint) GetDecimalLong() (dLong string)

GetDecimalLong returns the longitude in decimal degrees of the grid point as a string

func (GridPoint) GetDistance

func (gp GridPoint) GetDistance(lat, long string) (distance float64, err error)

GetDistance takes a latitude and longitude in decimal degrees and calculates the distance of that point to the GridPoint, in meters

func (GridPoint) GetFullEasting

func (gp GridPoint) GetFullEasting() (easting string)

GetFullEasting returns the full-length easting of the grid point as a string

func (GridPoint) GetFullNorthing

func (gp GridPoint) GetFullNorthing() (northing string)

GetFullNorthing returns the full-length northing of the grid point as a string

func (GridPoint) GetLatSeconds

func (gp GridPoint) GetLatSeconds() (secs string)

GetLatSeconds returns the seconds reading of the grid point's latitude as a string

func (GridPoint) GetLongSeconds

func (gp GridPoint) GetLongSeconds() (secs string)

GetLongSeconds returns the seconds reading of the grid point's longitude as a string

type MapGrid

type MapGrid map[string]TasMap

MapGrid holds a dictionary of TASMAP three-letter acronyms containing the map's necessary data to calculate the full grid reference

func NewTasMapGrid

func NewTasMapGrid() *MapGrid

NewTasMapGrid returns a TasMap object

type TasMap

type TasMap struct {
	// contains filtered or unexported fields
}

TasMap holds map-unique information: the UTM zone, alphanumeric code, as well as the lowest easting and northing 1000m lines

Jump to

Keyboard shortcuts

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