Skip to content

Commit

Permalink
COMPAT: fwd and bkwd compatibility with fiona CRS (#913)
Browse files Browse the repository at this point in the history
Background: Toblerity/Fiona#714.
  • Loading branch information
sgillies authored and jorisvandenbossche committed Apr 18, 2019
1 parent 0fbc7ef commit 62bc3f7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion geopandas/io/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,15 @@ def read_file(filename, bbox=None, **kwargs):

with fiona_env():
with reader(path_or_bytes, **kwargs) as features:
crs = features.crs

# In a future Fiona release the crs attribute of features will
# no longer be a dict. The following code will be both forward
# and backward compatible.
if hasattr(features.crs, 'to_dict'):
crs = features.crs.to_dict()
else:
crs = features.crs

if bbox is not None:
if isinstance(bbox, GeoDataFrame) or isinstance(bbox, GeoSeries):
bbox = tuple(bbox.to_crs(crs).total_bounds)
Expand Down

0 comments on commit 62bc3f7

Please sign in to comment.