-
Notifications
You must be signed in to change notification settings - Fork 203
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
Add Feature, Geometry and ObjectEncoder classes to model #787
Conversation
Builder classes now return Feature and Geometry, not dicts Usage throughout fiona has been updated.
@@ -5,7 +5,7 @@ from __future__ import absolute_import | |||
import logging | |||
|
|||
from fiona.errors import UnsupportedGeometryTypeError | |||
|
|||
from fiona.model import GEOMETRY_TYPES, Geometry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid circular import.
fiona/_transform.pyx
Outdated
@@ -127,6 +128,9 @@ def _transform_geom( | |||
cdef void *dst_ogr_geom = NULL | |||
cdef int i | |||
|
|||
if not isinstance(geom, Geometry): | |||
geom = Geometry.from_dict(**geom) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is perhaps better done in transform.py. We could strictly require Geometry in the extension module since it isn't in the public API.
@jorisvandenbossche you might want to have a look at this too. Fiona 1.9 will still accept data as dicts but will start returning dict-like Feature objects that are not instances of dict. I'm eager to get this merged in so I can move on to supporting GDAL 3.0. |
@sgillies this looks good to me. I quickly tried out this branch with geopandas, and as expected all tests pass without problems. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I've requested some minor changes. My main question is why the need for Geometry
/_Geometry
?
Builder classes now return Feature and Geometry, not dicts Usage throughout fiona has been updated.
@snorfalorpagus to your question, very belatedly 😆 , the Geometry/_Geometry design was is anticipation of rewriting _Geometry as a Cython extension class, but now I think it was misguided. I'll probably undo it in a future PR. |
Resolves #760
Resolves #758