{"id":13995282,"url":"https://github.com/georust/geos","last_synced_at":"2025-04-07T05:06:58.953Z","repository":{"id":37748522,"uuid":"76482208","full_name":"georust/geos","owner":"georust","description":"Rust bindings for GEOS","archived":false,"fork":false,"pushed_at":"2024-09-04T23:30:33.000Z","size":696,"stargazers_count":123,"open_issues_count":17,"forks_count":42,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-10-29T20:22:35.934Z","etag":null,"topics":["geos","geospatial","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/geos/","language":"Rust","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/georust.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2016-12-14T17:34:33.000Z","updated_at":"2024-10-22T07:51:59.000Z","dependencies_parsed_at":"2024-04-20T14:04:23.798Z","dependency_job_id":"9bf018fd-0129-4882-a0bb-9847bac61c8c","html_url":"https://github.com/georust/geos","commit_stats":{"total_commits":240,"total_committers":29,"mean_commits":8.275862068965518,"dds":0.5416666666666667,"last_synced_commit":"6dc900521b8bc6797a388c6be219b6282cea12a8"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georust%2Fgeos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georust%2Fgeos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georust%2Fgeos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/georust%2Fgeos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/georust","download_url":"https://codeload.github.com/georust/geos/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246998368,"owners_count":20866725,"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":["geos","geospatial","rust"],"created_at":"2024-08-09T14:03:20.101Z","updated_at":"2025-04-07T05:06:58.933Z","avatar_url":"https://github.com/georust.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# geos\n\nRust bindings for [GEOS](https://libgeos.org/) C API.\n\nThe supported geos version is \u003e= 3.5\n\n### Disclaimer\n\nGEOS can be a tad strict on the validity on the input geometry and is prone to crash on invalid input, so they need to be checked in the wrapper.\nThis project is checked with valgrind, but if you stumble on a crash feel free to open an issue explaining the problem.\n\n### Usage example\n\nYou can check the examples in the `examples/` directory.\n\n### Constructing geometries from WKT:\n\n```rust\nuse geos::Geom;\n\nlet gg1 = geos::Geometry::new_from_wkt(\"POLYGON ((0 0, 0 5, 6 6, 6 0, 0 0))\")\n                         .expect(\"invalid WKT\");\nlet gg2 = geos::Geometry::new_from_wkt(\"POLYGON ((1 1, 1 3, 5 5, 5 1, 1 1))\")\n                         .expect(\"invalid WKT\");\nlet mut gg3 = gg1.difference(\u0026gg2).expect(\"difference failed\");\n// normalize is only used for consistent ordering of vertices\ngg3.normalize().expect(\"normalize failed\");\nassert_eq!(\n    gg3.to_wkt_precision(0).expect(\"to_wkt failed\"),\n    \"POLYGON ((0 0, 0 5, 6 6, 6 0, 0 0), (1 1, 5 1, 5 5, 1 3, 1 1))\",\n);\n```\n\n### \"Preparing\" the geometries for faster predicates (intersects, contains, etc.) computation on repetitive calls:\n\n```rust\nlet g1 = geos::Geometry::new_from_wkt(\"POLYGON ((0 0, 0 5, 5 5, 5 0, 0 0))\")\n                        .expect(\"invalid WKT\");\nlet g2 = geos::Geometry::new_from_wkt(\"POLYGON ((1 1, 1 3, 5 5, 5 0, 1 1))\")\n                        .expect(\"invalid WKT\");\n\nlet pg1 = geos::PreparedGeometry::new(\u0026g1)\n                                 .expect(\"PreparedGeometry::new failed\");\nlet result = pg1.intersects(\u0026g2).expect(\"intersects failed\");\nassert_eq!(result, true);\n```\n\n### Conversion from [geo](https://github.com/georust/geo)\n\n[geo](https://github.com/georust/geo)'s objects can be converted into [GEOS](https://libgeos.org/)\nto use all geos algorithms.\n\nComplete example can be found in `examples/from_geo.rs`\n\n```rust,ignore\nuse geos::geo_types::{LineString, Coord, Polygon};\n\n// first we create a Geo object\nlet exterior = LineString(vec![\n    Coord::from((0., 0.)),\n    Coord::from((0., 1.)),\n    Coord::from((1., 1.)),\n]);\nlet interiors = vec![\n    LineString(vec![\n        Coord::from((0.1, 0.1)),\n        Coord::from((0.1, 0.9)),\n        Coord::from((0.9, 0.9)),\n    ]),\n];\nlet p = Polygon::new(exterior, interiors);\n// and we can create a Geos geometry from this object\nlet geom: geos::Geometry = (\u0026p).try_into()\n                               .expect(\"failed conversion\");\n// do some stuff with geom\n```\n\n### Voronoi\n\n[Voronoi](https://en.wikipedia.org/wiki/Voronoi_diagram) diagrams computation are available in the bindings.\n\nFor those to be easier to use with [geo](https://github.com/georust/geo) some helpers are available in `voronoi.rs`.\n\n```rust,ignore\nuse geos::compute_voronoi;\nuse geos::geo_types::Point;\n\nlet points = vec![\n    Point::new(0., 0.),\n    Point::new(0., 1.),\n    Point::new(1., 1.),\n    Point::new(1., 0.),\n];\n\nlet voronoi = compute_voronoi(\u0026points, None, 0., false)\n                  .expect(\"compute_voronoi failed\");\n```\n\n## Static build\n\nBy default, this crate links dynamically to your system-installed GEOS or a\ndifferent version that you configure. See [sys/README.md](./sys/README.md) for\nmore information.\n\nIf you want to link GEOS statically, use the `static` feature.\n\nThe static build uses the GEOS version in the git submodule in`sys/geos-src/source`.\nThis is currently GEOS 3.12.1.\n\nYou will need to have a build environment supported for the static version of\nGEOS. See [GEOS build instructions](https://libgeos.org/usage/download/#build-from-source)\nfor more information but please note that instructions may be for a newer\nversion of GEOS than is currently included in the static build.\n\n## Contributing\n\nOnly a subset of geos has been implemented, feel free to add wrappers for missing features.\n\nAll added features needs to be tested and this being a C wrapper, valgrind runs on all examples/tests to check that\nno bugs / memory leaks are lurking.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorust%2Fgeos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeorust%2Fgeos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeorust%2Fgeos/lists"}