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

Support for nonlinear geometries #492

Closed
snorfalorpagus opened this issue Nov 5, 2017 · 11 comments
Closed

Support for nonlinear geometries #492

snorfalorpagus opened this issue Nov 5, 2017 · 11 comments

Comments

@snorfalorpagus
Copy link
Member

GDAL 2.0 introduced support for nonlinear geometries, such as CIRCULARSTRING and CURVEPOLYGON. There are also some functions converting to/from their linear approximations.

https://trac.osgeo.org/gdal/wiki/rfc49_curve_geometries

I don't think it would be too difficult to add support for this in Fiona.

@kannes
Copy link
Contributor

kannes commented May 8, 2018

I am currently mentoring a project where we would love to use Fiona instead of the official GDAL Python bindings. Our data has lots of curve geometries though so this is a blocker for us.

Is it worth trying to simply uncomment the types in https://github.com/Toblerity/Fiona/blob/master/fiona/_geometry.pyx#L18 and hope for the best? Or are there other places in the code where will is going to fail spectacularly?

@sgillies
Copy link
Member

sgillies commented May 8, 2018

@kannes That is one change that we will need. A big missing piece is that OGR_G_GetLinearGeometry will need to be called before https://github.com/Toblerity/Fiona/blob/master/fiona/_geometry.pyx#L163 in GeomBuilder.build to coerce curve geometries to their linear approximations. We can't represent curve geometries as GeoJSON.

https://trac.osgeo.org/gdal/wiki/rfc49_curve_geometries

@snorfalorpagus
Copy link
Member Author

I think there is a debate to be had re: returning the curved geometries vs their linear approximation. From my understanding curved geometries are still just a type and some coordinate sequences. The objects returned by Fiona are GeoJSON-like structures only. I would expect we could return structures for these, otherwise round trip operations are not possible. I do think we should make the linear approximations available thought.

@kannes
Copy link
Contributor

kannes commented May 8, 2018

And I just realised that of course we use Shapely for actual geometric stuff. D'oh!

Still, looking forward to the day when Fiona supports this :)

@jwilson8767
Copy link

Currently this is breaking things for me as prior to gdal 2.2 curve geometries were automatically approximated, post-2.2 fiona just throws a "UnsupportedGeometryTypeError". While I agree that preserving curves would be awesome for round-trip operations, in the short term I suggest we implement the suggested GetLinearGeometry to restore the previous behavior. Perhaps we could also check for non-linear geometries and show a warning that the geometry will be approximated.

@snorfalorpagus
Copy link
Member Author

I made a start on full support for curved geometries not long after my last comment. It was going quite well until I realised we need to decide on an exact format for some of the more complicated geometry types. I wasn't aware that Fiona was already interpolating geometries with earlier versions of GDAL.

@jwilson8767
Copy link

Should we maybe create a separate issue for fixing the silent approximation vs actually full supporting curve geometries, especially as it sounds like full support may take more work than originally expected?

@sgillies
Copy link
Member

Yes, two issues makes the most sense. Let's let this one continue as the issue about full support, including JSON representations of non-linear geometries.

@jwilson8767
Copy link

Was just looking at RFC 49: Curve geometries and realized that GEOS (and thereby shapely) is specifically mentioned as not supporting non-linear geometries at this time. A quick glance over the GEOS wiki makes it look like curve geometries are not even planned, but I could be wrong. -- Anyone know how to support getting non-linear geometries implemented in GEOS?

@sgillies
Copy link
Member

Fix for #617 is pretty much done in #643.

@sgillies sgillies removed the GDAL2 label Jan 1, 2019
@sgillies
Copy link
Member

sgillies commented Mar 5, 2024

I'm going to close this in favor of #1345.

@sgillies sgillies closed this as completed Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants