{"id":16940729,"url":"https://github.com/twpayne/go-geos","last_synced_at":"2025-04-05T11:06:54.809Z","repository":{"id":37859199,"uuid":"261541008","full_name":"twpayne/go-geos","owner":"twpayne","description":"Package geos provides an interface to GEOS.","archived":false,"fork":false,"pushed_at":"2025-03-04T09:13:00.000Z","size":448,"stargazers_count":98,"open_issues_count":2,"forks_count":11,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-29T10:05:05.474Z","etag":null,"topics":["geometry","geos","geospatial","gis","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/twpayne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-05T17:36:21.000Z","updated_at":"2025-03-27T13:51:49.000Z","dependencies_parsed_at":"2024-02-01T01:23:55.401Z","dependency_job_id":"26be1295-6940-4934-aca8-9098da784f38","html_url":"https://github.com/twpayne/go-geos","commit_stats":{"total_commits":269,"total_committers":8,"mean_commits":33.625,"dds":0.6282527881040892,"last_synced_commit":"c9ed31526fa2ee3599ffe0fdf4556a6cf9c0b204"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twpayne%2Fgo-geos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twpayne%2Fgo-geos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twpayne%2Fgo-geos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twpayne%2Fgo-geos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twpayne","download_url":"https://codeload.github.com/twpayne/go-geos/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247325693,"owners_count":20920714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geometry","geos","geospatial","gis","go","golang"],"created_at":"2024-10-13T21:07:47.310Z","updated_at":"2025-04-05T11:06:54.752Z","avatar_url":"https://github.com/twpayne.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-geos\n\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/twpayne/go-geos)](https://pkg.go.dev/github.com/twpayne/go-geos)\n\nPackage `go-geos` provides an interface to [GEOS](https://libgeos.org).\n\n## Install\n\n```console\n$ go get github.com/twpayne/go-geos\n```\n\nYou must also install the GEOS development headers and libraries. These are\ntypically in the package `libgeos-dev` on Debian-like systems, `geos-devel` on\nRedHat-like systems, and `geos` in Homebrew.\n\n## Features\n\n* Fluent Go API.\n\n* Low-level `Context`, `CoordSeq`, `Geom`, `PrepGeom`, and `STRtree` types\n  provide access to all GEOS methods.\n\n* High-level `geometry.Geometry` type implements all GEOS functionality and\n  many standard Go interfaces:\n\n  * `database/sql/driver.Valuer` and `database/sql.Scanner` (WKB) for PostGIS\n     database integration.\n  * `encoding/json.Marshaler` and `encoding/json.Unmarshaler` (GeoJSON).\n  * `encoding/xml.Marshaler` (KML).\n  * `encoding.BinaryMarshaler` and `encoding.BinaryUnmarshaler` (WKB).\n  * `encoding.TextMarshaler` and `encoding.TextUnmarshaler` (WKT).\n  * `encoding/gob.GobEncoder` and `encoding/gob.GobDecoder` (GOB).\n\n  See the [PostGIS example](examples/postgis/README.md) for a demonstration of\n  the use of these interfaces.\n\n* Concurrency-safe. `go-geos` uses GEOS's threadsafe `*_r` functions under the\n  hood, with locking to ensure safety, even when used across multiple\n  goroutines. For best performance, use one `geos.Context` per goroutine.\n\n* Caching of geometry properties to avoid cgo overhead.\n\n* Optimized GeoJSON encoder.\n\n* Automatic finalization of GEOS objects.\n\n## Memory management\n\n`go-geos` objects live mostly on the C heap. `go-geos` sets finalizers on the\nobjects it creates that free the associated C memory. However, the C heap is not\nvisible to the Go runtime. The can result in significant memory pressure as\nmemory is consumed by large, non-finalized geometries, of which the Go runtime\nis unaware. Consequently, if it is known that a geometry will no longer be used,\nit should be explicitly freed by calling its `Destroy()` method. Periodic calls\nto `runtime.GC()` can also help, but the Go runtime makes no guarantees about\nwhen or if finalizers will be called.\n\nYou can set a function to be called whenever a geometry's finalizer is invoked\nwith the `WithGeomFinalizeFunc` option to `NewContext()`. This can be helpful\nfor tracking down geometry leaks.\n\nFor more information, see the [documentation for\n`runtime.SetFinalizer()`](https://pkg.go.dev/runtime#SetFinalizer) and [this\nthread on\n`golang-nuts`](https://groups.google.com/g/golang-nuts/c/XnV16PxXBfA/m/W8VEzIvHBAAJ).\n\n## Errors, exceptions, and panics\n\n`go-geos` uses the stable GEOS C bindings. These bindings catch exceptions from\nthe underlying C++ code and convert them to an integer return code. For normal\ngeometry operations, `go-geos` panics whenever it encounters a GEOS return code\nindicating an error, rather than returning an `error`. Such panics will not\noccur if `go-geos` is used correctly. Panics will occur for invalid API calls,\nout-of-bounds access, or operations on invalid geometries. This behavior is\nsimilar to slice access in Go (out-of-bounds accesses panic) and keeps the API\nfluent. When parsing data, errors are expected so an `error` is returned.\n\n## Comparison with `github.com/twpayne/go-geom`\n\n[`github.com/twpayne/go-geom`](https://github.com/twpayne/go-geom) is a pure Go\nlibrary providing similar functionality to `go-geos`. The major differences are:\n\n* `go-geos` uses [GEOS](https://libgeos.org), which is an extremely mature\n  library with a rich feature set.\n* `go-geos` uses cgo, with all the disadvantages that that entails, notably\n  expensive function call overhead, more complex memory management and trickier\n  cross-compilation.\n* `go-geom` uses a cache-friendly coordinate layout which is generally faster\n  than GEOS for many operations.\n\n`go-geos` is a good fit if your program is short-lived (meaning you can ignore\nmemory management), or you require the battle-tested geometry functions provided\nby GEOS and are willing to handle memory management manually. `go-geom` is\nrecommended for long-running processes with less stringent geometry function\nrequirements.\n\n## GEOS version compatibility\n\n`go-geos` is tested to work with the versions of `GEOS` tested on CI.\nSee [here](.github/workflows/main.yml).\n\nCalling functions unsupported by the underlying `GEOS` library will result in a panic.\nUsers can use [`VersionCompare`](https://pkg.go.dev/github.com/twpayne/go-geos#VersionCompare)\nto be sure that a function exists.\n\n## Contributing\n\nPlease check [`CONTRIBUTING.md`](./CONTRIBUTING.md) for instructions before you open a pull-request!\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwpayne%2Fgo-geos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwpayne%2Fgo-geos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwpayne%2Fgo-geos/lists"}