Skip to content

Commit

Permalink
Add geo interface support to Feature.from_dict
Browse files Browse the repository at this point in the history
  • Loading branch information
sgillies committed Jan 22, 2023
1 parent b0f1f43 commit 7484a37
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Changes

All issue numbers are relative to https://github.com/Toblerity/Fiona/issues.

1.9b2 (TBD)
-----------
1.9b2 (2023-01-22)
------------------

- Add Feature.__geo_interface__ property (#1181).
- Invalid creation options are filtered and ignored (#1180).
Expand Down
4 changes: 2 additions & 2 deletions fiona/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ def __init__(self, geometry=None, id=None, properties=None, **data):
super(Feature, self).__init__(**data)

@classmethod
def from_dict(cls, mapping=None, **kwargs):
data = dict(mapping or {}, **kwargs)
def from_dict(cls, ob=None, **kwargs):
data = dict(getattr(ob, "__geo_interface__", ob) or {}, **kwargs)
geom_data = data.pop("geometry", None)

if isinstance(geom_data, Geometry):
Expand Down

0 comments on commit 7484a37

Please sign in to comment.