Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/twpayne/go-geom
Package geom implements efficient geometry types for geospatial applications.
https://github.com/twpayne/go-geom
2d 3d decoding encoding ewkb geo geojson geom geometry-functions geospatial gis go golang kml wkb wkt
Last synced: about 2 hours ago
JSON representation
Package geom implements efficient geometry types for geospatial applications.
- Host: GitHub
- URL: https://github.com/twpayne/go-geom
- Owner: twpayne
- License: bsd-2-clause
- Created: 2014-03-06T13:39:28.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2024-08-18T17:27:30.000Z (5 months ago)
- Last Synced: 2025-01-09T00:17:07.671Z (7 days ago)
- Topics: 2d, 3d, decoding, encoding, ewkb, geo, geojson, geom, geometry-functions, geospatial, gis, go, golang, kml, wkb, wkt
- Language: Go
- Homepage:
- Size: 1.03 MB
- Stars: 867
- Watchers: 15
- Forks: 105
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - go-geom
- awesome-starred - twpayne/go-geom - Package geom implements efficient geometry types for geospatial applications. (golang)
README
# go-geom
[![PkgGoDev](https://pkg.go.dev/badge/github.com/twpayne/go-geom)](https://pkg.go.dev/github.com/twpayne/go-geom)
[![Go Report Card](https://goreportcard.com/badge/github.com/twpayne/go-geom)](https://goreportcard.com/report/github.com/twpayne/go-geom)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`](https://pkg.go.dev/database/sql#Scanner) and
[`driver.Value`](https://pkg.go.dev/database/sql/driver#Value) interface
implementations for easy database integration.
* [2D](https://pkg.go.dev/github.com/twpayne/go-geom/xy) and
[3D](https://pkg.go.dev/github.com/twpayne/go-geom/xyz) topology functions.
* Efficient, cache-friendly [internal representation](INTERNALS.md).
* Optional protection against malicious or malformed inputs.## Examples
* [PostGIS, EWKB, and GeoJSON](https://github.com/twpayne/go-geom/tree/master/examples/postgis).
## Detailed features
### Geometry types
* [Point](https://pkg.go.dev/github.com/twpayne/go-geom#Point)
* [LineString](https://pkg.go.dev/github.com/twpayne/go-geom#LineString)
* [Polygon](https://pkg.go.dev/github.com/twpayne/go-geom#Polygon)
* [MultiPoint](https://pkg.go.dev/github.com/twpayne/go-geom#MultiPoint)
* [MultiLineString](https://pkg.go.dev/github.com/twpayne/go-geom#MultiLineString)
* [MultiPolygon](https://pkg.go.dev/github.com/twpayne/go-geom#MultiPolygon)
* [GeometryCollection](https://pkg.go.dev/github.com/twpayne/go-geom#GeometryCollection)### Encoding and decoding
* [GeoJSON](https://pkg.go.dev/github.com/twpayne/go-geom/encoding/geojson)
* [IGC](https://pkg.go.dev/github.com/twpayne/go-geom/encoding/igc)
* [KML](https://pkg.go.dev/github.com/twpayne/go-geom/encoding/kml) (encoding only)
* [WKB](https://pkg.go.dev/github.com/twpayne/go-geom/encoding/wkb)
* [EWKB](https://pkg.go.dev/github.com/twpayne/go-geom/encoding/ewkb)
* [WKT](https://pkg.go.dev/github.com/twpayne/go-geom/encoding/wkt) (encoding only)
* [WKB Hex](https://pkg.go.dev/github.com/twpayne/go-geom/encoding/wkbhex)
* [EWKB Hex](https://pkg.go.dev/github.com/twpayne/go-geom/encoding/ewkbhex)### Geometry functions
* [XY](https://pkg.go.dev/github.com/twpayne/go-geom/xy) 2D geometry functions
* [XYZ](https://pkg.go.dev/github.com/twpayne/go-geom/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
* [github.com/twpayne/go-gpx](https://github.com/twpayne/go-gpx) GPX encoding and decoding
* [github.com/twpayne/go-kml](https://github.com/twpayne/go-kml) KML encoding
* [github.com/twpayne/go-polyline](https://github.com/twpayne/go-polyline) Google Maps Polyline encoding and decoding
* [github.com/twpayne/go-vali](https://github.com/twpayne/go-vali) IGC validation## License
BSD-2-Clause