Categorygithub.com/toyo/go-latlong
modulepackage
0.0.0-20230417065643-3f8c4b760af4
Repository: https://github.com/toyo/go-latlong.git
Documentation: pkg.go.dev

# README

go-latlong

Job Status Report Build Status GoDoc

Usage

This is an golang struct for store latitude, longitude and altitude by numerical, GridLocator and GeoHash.

To use the method of this struct, you can get GridLocator and GeoHash which length is considered in precision.

Application

package main

import (
	"fmt"

	"github.com/toyo/go-latlong"
)

func main() {
	l := latlong.NewRect(35, 135, 0.1, 0.1) // N35+-0.05 Deg. E135+-0.05 Deg.

	fmt.Println(l.GridLocator()) // shows GridLocator. https://en.wikipedia.org/wiki/Maidenhead_Locator_System
	fmt.Println(l.GeoHash())     // shows GeoHash. http://geohash.org/
	fmt.Println(l.String())      // shows lat/long in string.
}

Class of this librarys2geometry.ioGeoJSONmemo
Points2.LatLng (+altitude)Point
MultiPoint (= []Point )-MultiPointis for ISO6709
LineStrings2.PolylineLineString
Polygons2.LoopPolygonwith no hole
Circles2.CapCircleGeoJSON 1.1
Rects2.Rect-

# Packages

No description provided by the author

# Functions

AngleFromBytes creates Angle from []byte to unmarshal.
EarthArcFromAngle makes Angle to Distance.
EarthArcFromChordAngle makes ChordAngle to Distance.
NewAngle is constructor for Angle.
NewAngleFromS1Angle is constructor for Angle.
NewCircle is constuctor for Circle.
NewEmptyCircle is constructor for Circle with empty.
NewGeoJSONFeatureCollection creates GeoJSONFeatureCollection.
NewGeoJSONGeometry is constructor.
NewPoint is from latitude, longitude and altitude.
NewPointCircle is constructor for Circle with radius = prec.
NewPointFromS2Point is from s2.Point.
NewRect is from latitude, longitude and altitude.
NewRectGeoHash is from GeoHash http://geohash.org/.
NewRectGridLocator is from Grid Locator.

# Variables

Config is an configuration of environment.

# Structs

Angle is Angle with precision.
Circle is Circle.
GeoJSONFeature is Feature of GeoJSON.
GeoJSONFeatureCollection is FeatureCollection of GeoJSON.
GeoJSONGeometry is Geometry of GeoJSON type GeoJSONGeometry struct { Type string `json:"type"` Coordinates json.RawMessage `json:"coordinates"` Radius *float64 `json:"radius,omitempty"` // only for Circle, which is GeoJSON specification 1.1 and leter.
LineString inherited MultiPoint.
Point is Latitude & Longitude with precision.
Polygon inherited MultiPoint.
Rect is rectangle of latlng.

# Interfaces

Geometry is interface for each geometry class @ GeoJSON.

# Type aliases

Km is kilo-meter.
MultiPoint is slice of *Point.