Comments (2)
A MultiPolygon
is implemented as a Vec
of Polygons
, so if you need an object of Polygon, you can take the Polygon
from the inner Vec.
use geo::{MultiPolygon, Polygon, polygon};
let mut multi_polygon: MultiPolygon = MultiPolygon::new(vec![polygon![(x: 0.0, y: 0.0), (x: 2.0, y: 0.0), (x: 1.0, y: 2.0)]]);
let polygon: Polygon = multi_polygon.0.remove(0);
println!("polygon: {:?}", polygon);
If that's not what you mean, could you please clarify by providing some example code that you'd like to be able to write, but currently cannot.
from geo.
Yeah, quite similar. I'd like some syntax like below, preferably. Where the Result panics if the inner vector is greater than length 1.
use geo::{MultiPolygon, Polygon, polygon};
let multi_polygon: MultiPolygon = MultiPolygon::new(vec![polygon![(x: 0.0, y: 0.0), (x: 2.0, y: 0.0), (x: 1.0, y: 2.0)]]);
let inner_poly: Polygon = multi_polygon.try_from().unwrap();
from geo.
Related Issues (20)
- Panic in BooleanOps::union for Polygon<f32> HOT 6
- VecSet may cause panics HOT 7
- Proposal: Common abstraction layer for collection types (via `Deref` and `DerefMut`) HOT 2
- Add delauney triangulation algorithm to root `geo` crate docs index
- Thoughts on algorithms for trait-based geometries
- concave_hull returns nonsense results for simple polygons HOT 1
- Panic in RegionAssembly reproducibly HOT 4
- Clarify that current cross-track distance uses spherical (Haversine) earth model, add Ellipsoidal (Vincenty) version HOT 2
- Missing `contains` implementations
- `is_valid` for all geometry types. HOT 3
- Problems building with Rust 1.75.0 HOT 1
- Add is_equal_topo method to IntersectionMatrix to determine topological equality
- How to calculate intersection area of two rotated rectangles? HOT 2
- Missing PointZ implementations HOT 1
- Latest ahash dep and Rust 1.70.0 are incompatible HOT 4
- 3D (3-dimensional) data types HOT 2
- Rhumb destinations do not wrap angles after the first pole intersection HOT 8
- GeodesicDestination produces cyclcically incosistent results HOT 5
- Expose fields in AffineTransform struct (or have a way to access the internal values)? HOT 4
- st_makeline function HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geo.