package
0.11.1
Repository: https://github.com/paulmach/orb.git
Documentation: pkg.go.dev

# README

orb/project Godoc Reference

Package project has helper function for projecting geometries.

Examples

Project orb.Point to Mercator:

sf := orb.Point{-122.416667, 37.783333}
merc := project.Point(sf, project.WGS84.ToMercator)

fmt.Println(merc)
// Output:
// [-1.3627361035049736e+07 4.548863085837512e+06]

Find centroid of polygon in Mercator projection:

poly := orb.Polygon{
    {
        {-122.4163816, 37.7792782},
        {-122.4162786, 37.7787626},
        {-122.4151027, 37.7789118},
        {-122.4152143, 37.7794274},
        {-122.4163816, 37.7792782},
    },
}

merc := project.Polygon(poly, project.WGS84.ToMercator)
centroid, _ := planar.CentroidArea(merc)

centroid = project.Mercator.ToWGS84(centroid)

fmt.Println(centroid)
// Output:
// [-122.41574403384001 37.77909471899779]

# Functions

Bound is a helper to project a rectangle.
Collection is a helper to project a rectangle.
Geometry is a helper to project any geomtry.
LineString is a helper to project an entire line string.
MercatorScaleFactor returns the mercator scaling factor for a given degree latitude.
MultiLineString is a helper to project an entire multi linestring.
MultiPoint is a helper to project an entire multi point.
MultiPolygon is a helper to project an entire multi polygon.
Point is a helper to project an a point.
Polygon is a helper to project an entire polygon.
Ring is a helper to project an entire ring.

# Variables

Mercator performs the Spherical Pseudo-Mercator projection used by most web maps.
WGS84 is what common uses lon/lat projection.