All Projects → georust → Geos

georust / Geos

Licence: mit
Rust bindings for GEOS

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Geos

Ofbiz
Apache OFBiz - Main development has moved to the ofbiz-frameworks repository.
Stars: ✭ 719 (+1572.09%)
Mutual labels:  geospatial
Cesium
An open-source JavaScript library for world-class 3D globes and maps 🌎
Stars: ✭ 8,095 (+18725.58%)
Mutual labels:  geospatial
Kepler.gl
Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
Stars: ✭ 8,231 (+19041.86%)
Mutual labels:  geospatial
Agentmaps
Make social simulations on interactive maps with Javascript! Agent-based modeling for the web.
Stars: ✭ 822 (+1811.63%)
Mutual labels:  geospatial
Postgis
PostGIS spatial database extension to PostgreSQL [mirror]
Stars: ✭ 925 (+2051.16%)
Mutual labels:  geospatial
Lycheepy
LycheePy is a distributed processing server of geospatial data
Stars: ✭ 15 (-65.12%)
Mutual labels:  geospatial
Leaflet Dvf
Leaflet Data Visualization Framework
Stars: ✭ 678 (+1476.74%)
Mutual labels:  geospatial
Freenet
FPGA: Fast Patch-Free Global Learning Framework for Fully End-to-End Hyperspectral Image Classification (TGRS 2020) https://ieeexplore.ieee.org/document/9007624
Stars: ✭ 40 (-6.98%)
Mutual labels:  geospatial
Rlur
Shiny dashboard for Land Use Regression modelling
Stars: ✭ 8 (-81.4%)
Mutual labels:  geospatial
Geemap
A Python package for interactive mapping with Google Earth Engine, ipyleaflet, and folium
Stars: ✭ 959 (+2130.23%)
Mutual labels:  geospatial
Lpfmpoints
Evolution of LPFM Stations
Stars: ✭ 19 (-55.81%)
Mutual labels:  geospatial
Proj4.jl
Julia wrapper for the PROJ cartographic projections library
Stars: ✭ 23 (-46.51%)
Mutual labels:  geospatial
Php7 Mapnik
PHP extension for geospatial rendering with Mapnik
Stars: ✭ 15 (-65.12%)
Mutual labels:  geospatial
Earthengine Py Notebooks
A collection of 360+ Jupyter Python notebook examples for using Google Earth Engine with interactive mapping
Stars: ✭ 807 (+1776.74%)
Mutual labels:  geospatial
Rust S2
S2 geometry library in Rust
Stars: ✭ 35 (-18.6%)
Mutual labels:  geospatial
Mapserver
Source code of the MapServer project. Please submit pull requests to the 'main' branch.
Stars: ✭ 693 (+1511.63%)
Mutual labels:  geospatial
Incubator Sedona
A cluster computing framework for processing large-scale geospatial data
Stars: ✭ 860 (+1900%)
Mutual labels:  geospatial
Shapefile.jl
Parsing .shp files in Julia
Stars: ✭ 40 (-6.98%)
Mutual labels:  geospatial
Leaflet.extras2
Extra functionality for leaflet R package.
Stars: ✭ 37 (-13.95%)
Mutual labels:  geospatial
Wellknown
WKT <-> GeoJSON
Stars: ✭ 15 (-65.12%)
Mutual labels:  geospatial

geos

Build Status

Rust bindings for GEOS C API.

The supported geos version is >= 3.5

Disclaimer

GEOS 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. This project is checked with valgrind, but if you stumble on a crash feel free to open an issue explaining the problem.

Usage example

You can check the examples in the examples/ directory.

Constructing geometries from WKT:

extern crate geos;

let gg1 = geos::Geometry::new_from_wkt("POLYGON ((0 0, 0 5, 6 6, 6 0, 0 0))").expect("invalid WKT");
let gg2 = geos::Geometry::new_from_wkt("POLYGON ((1 1, 1 3, 5 5, 5 1, 1 1))").expect("invalid WKT");
let gg3 = gg1.difference(&gg2).expect("difference failed");
assert_eq!(
    gg3.to_wkt_precision(0).expect("to_wkt failed"),
    "POLYGON ((0 0, 0 5, 6 6, 6 0, 0 0), (1 1, 5 1, 5 5, 1 3, 1 1))",
);

"Preparing" the geometries for faster predicates (intersects, contains, etc.) computation on repetitive calls:

extern crate geos;

let g1 = geos::Geometry::new_from_wkt("POLYGON ((0 0, 0 5, 5 5, 5 0, 0 0))").expect("invalid WKT");
let g2 = geos::Geometry::new_from_wkt("POLYGON ((1 1, 1 3, 5 5, 5 0, 1 1))").expect("invalid WKT");

let pg1 = geos::PreparedGeometry::new(&g1).expect("PreparedGeometry::new failed");
let result = pg1.intersects(&g2).expect("intersects failed");
assert_eq!(result, true);

Conversion from geo

geo's objects can be converted into GEOS to use all geos algorithms.

Complete example can be found in examples/from_geo.rs

extern crate geos;
extern crate geo_types;

use geos::from_geo::TryInto;
use geo_types::{LineString, Coordinate, Polygon};

// first we create a Geo object
let exterior = LineString(vec![
    Coordinate::from((0., 0.)),
    Coordinate::from((0., 1.)),
    Coordinate::from((1., 1.)),
]);
let interiors = vec![
    LineString(vec![
        Coordinate::from((0.1, 0.1)),
        Coordinate::from((0.1, 0.9)),
        Coordinate::from((0.9, 0.9)),
    ]),
];
let p = Polygon::new(exterior, interiors);
// and we can create a Geos geometry from this object
let geom: geos::Geometry = (&p).try_into().expect("failed conversion");
// do some stuff with geom

Voronoi

Voronoi diagrams computation are available in the bindings.

For those to be easier to use with geo some helpers are available in voronoi.rs.

extern crate geo_types;

use geo_types::Point;
let points = vec![
    Point::new(0., 0.),
    Point::new(0., 1.),
    Point::new(1., 1.),
    Point::new(1., 0.),
];

let voronoi = geos::compute_voronoi(&points, None, 0., false).expect("compute_voronoi failed");

Contributing

Only a subset of geos has been implemented, feel free to add wrappers for missing features.

All added features needs to be tested and this being a C wrapper, valgrind runs on all examples/tests to check that no bugs / memory leaks are lurking.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].