Go library for handling geometries
Switch branches/tags
Nothing to show
Clone or download
twpayne Merge pull request #105 from twpayne/unlimited-geometry-elements
Do not limit geometry elements by default
Latest commit b7ac42d Dec 9, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bigxy Run goimports Jun 12, 2016
encoding Rename max to limit for consistency Dec 10, 2018
internal Document exported internal function Jun 2, 2018
scripts Check go vet output Sep 10, 2017
sorting Run goimports Jun 12, 2016
transform xy: remove unnecessary capacity Aug 2, 2017
xy Avoid ineffective assignment warning Jul 6, 2018
xyz Correct misspellings May 19, 2017
.travis.yml Explicitly test on go 1.11 Aug 25, 2018
INTERNALS.md Fix typos Jul 27, 2016
LICENSE Rename to go-geom Dec 2, 2015
README.md Add note about memory starvation DoS protection Dec 10, 2018
area_test.go When appropriate changed []float64 to Coord in order to provide some … Dec 8, 2015
bounds.go Reflow and add missing punctuation Nov 15, 2018
bounds_test.go Follow PostGIS polygon orientation in Bounds.Polygon Jun 14, 2018
derived.gen.go Use goderive Sep 10, 2017
flat_area.go Move division to top level call Dec 10, 2015
flat_deflate.go When appropriate changed []float64 to Coord in order to provide some … Dec 8, 2015
flat_geom0.go Document exported flat_geom functions Nov 15, 2018
flat_geom1.go Document exported flat_geom functions Nov 15, 2018
flat_geom2.go Document exported flat_geom functions Nov 15, 2018
flat_geom3.go Document exported flat_geom functions Nov 15, 2018
flat_inflate.go When appropriate changed []float64 to Coord in order to provide some … Dec 8, 2015
flat_length.go Add flat coordinates length functions Dec 5, 2015
geom.go Fix Coord documentation Nov 15, 2018
geom_test.go Add more geom3 test cases Aug 28, 2017
geometrycollection.go Always give a receiver name to make godoc look good Nov 15, 2018
geometrycollection_test.go Don't try to enforce SRIDs on GeometryCollections May 1, 2017
go.mod Add go modules support Aug 25, 2018
go.sum Add go modules support Aug 25, 2018
length_test.go When appropriate changed []float64 to Coord in order to provide some … Dec 8, 2015
linearring.go Use g as receiver name in LinearRing Nov 15, 2018
linearring_test.go Remove stray empty line Feb 17, 2016
linestring.go Use g as receiver name in LineString Nov 15, 2018
linestring_test.go Add TestLineStringReserve Aug 28, 2017
method_test.go Add Length for zero-length geometry types Dec 5, 2015
multilinestring.go Use g as receiver name in MultiLineString Nov 15, 2018
multilinestring_test.go When appropriate changed []float64 to Coord in order to provide some … Dec 8, 2015
multipoint.go Use g as receiver name in MultiPoint Nov 15, 2018
multipoint_test.go Check errors Jun 12, 2016
multipolygon.go Use g as receiver name in MultiPolygon Nov 15, 2018
multipolygon_test.go When appropriate changed []float64 to Coord in order to provide some … Dec 8, 2015
point.go Use g as receiver name in Point Nov 15, 2018
point_test.go Add TestPointSetSRID Aug 28, 2017
polygon.go Use g as receiver name in Polygon Nov 15, 2018
polygon_test.go When appropriate changed []float64 to Coord in order to provide some … Dec 8, 2015

README.md

go-geom

Build Status GoDoc Go Report Card

Package geom implements efficient geometry types for geospatial applications.

Key features

  • OpenGeo Consortium-style geometries.
  • Support for 2D and 3D geometries, measures (time and/or distance), and unlimited extra dimensions.
  • Encoding and decoding of common geometry formats (GeoJSON, KML, WKB, and others) including sql.Scanner and driver.Value interface implementations for easy database integration.
  • 2D and 3D topology functions.
  • Efficient, cache-friendly internal representation.
  • Optional protection against malicious or malformed inputs.

Detailed features

Geometry types

Encoding and decoding

Geometry functions

  • XY 2D geometry functions
  • XYZ 3D geometry functions

Protection against malicious or malformed inputs

The WKB and EWKB formats encode geometry sizes, and memory is allocated for those geometries. If the input is malicious or malformed, the memory allocation can be very large, leading to a memory starvation denial-of-service attack against the server. For example, a client might send a MultiPoint with header indicating that it contains 2^32-1 points. This will result in the server reading that geometry to allocate 2 * sizeof(float64) * (2^32-1) = 64GB of memory to store those points. By default, malicious or malformed input protection is disabled, but can be enabled by setting positive values for wkbcommon.MaxGeometryElements.

Related libraries

License