Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Area trait for Polygon to consider inner isles and implement area tait for MultiPolygon #43

Merged
merged 2 commits into from
Jul 20, 2016

Conversation

zarch
Copy link
Contributor

@zarch zarch commented Jul 18, 2016

No description provided.

@frewsxcv
Copy link
Member

Consider this example:

drawing

A is the outer ring. B and C are inner rings. With your Polygon Area algorithm, we'll calculate Area(A) - Area(B) - Area(C), which is different than calculating the green area in the image.

I wonder if there are other libraries that handle this scenario.

A natural response would be "this is an invalid Polygon since the inner rings fall outside the outer ring". I think this is a valid response for the time being unless someone knows of an easy way to do the correct calculation above.

@zarch What do you think? I think your changes are an improvement and I'm 👍 on merging them. Just want to pass this by you. Thanks for the pull request!

@waywardmonkeys
Copy link

Your polygons are invalid according to the "Simple Features" specification from the OGC.

@waywardmonkeys
Copy link

Also according to the GeoJSON spec, although that's much less rigorously defined: http://geojson.org/geojson-spec.html#polygon

@frewsxcv
Copy link
Member

Thanks for your input @waywardmonkeys, much appreciated!

This pull request looks good to me. @zarch Feel free to merge and deploy a new version (0.2.1). Otherwise I can do it myself sometime tomorrow. 🎊

@zarch
Copy link
Contributor Author

zarch commented Jul 19, 2016

Thank you @frewsxcv, in these days I was think that would be nice to add a trait like: IsValid (is_valid) that check if a geometry is valid or not.
I'm wondering if this check should be implemented in the rust-geo library or in an external one (rust-geo-validation? where is the right place to raise question on the georust ecosystem and structure?).
I think the validation should use different validation-driver (e.g. geos, grass gis, etc), and would be nice to have also function to fix the input (e.g. converting your example into a multipolygon).

@frewsxcv
Copy link
Member

in these days I was think that would be nice to add a trait like: IsValid (is_valid) that check if a geometry is valid or not. I'm wondering if this check should be implemented in the rust-geo library or in an external one (rust-geo-validation? where is the right place to raise question on the georust ecosystem and structure?).

For now, I think opening a new issue in this repository (rust-geo) should be fine for now.

I also just created https://github.com/georust/meta/ as a place to discuss GeoRust projects and the organization.

@frewsxcv frewsxcv merged commit 4d7a4a4 into georust:master Jul 20, 2016
zarch pushed a commit to zarch/rust-geo that referenced this pull request Jul 20, 2016
@zarch zarch deleted the area_polygon branch July 21, 2016 05:14
nyurik pushed a commit to nyurik/geo that referenced this pull request Mar 19, 2022
43: Use generic type for precision in conversion r=frewsxcv a=pjsier

Attempt to close georust#33. I based this off of the conversion implementation in [geojson](https://github.com/georust/geojson/blob/master/src/conversion.rs) and only used generic types for converting to `geo_types` objects

Initially I tried to update the `From` trait implementation, but I used `Into` instead because updating `From` gave me the following error:

```
type parameter `T` must be used as the type parameter for some local type
```

If I missed something that would make `From` work instead I can make that change. Let me know if I should change that or anything else here, thanks!

Co-authored-by: pjsier <pjsier@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants