ENH: Protect fiona imports so that they are not required at module level

This commit is contained in:
Kelsey Jordahl
2013-11-18 22:42:09 -06:00
parent 55f43a54ef
commit c2d5493516
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -7,7 +7,6 @@ import json
import os
import sys
import fiona
import numpy as np
from pandas import DataFrame, Series
from shapely.geometry import mapping
@@ -245,6 +244,7 @@ class GeoDataFrame(DataFrame):
The *kwargs* are passed to fiona.open and can be used to write
to multi-layer data, store data within archives (zip files), etc.
"""
import fiona
def convert_type(in_type):
if in_type == object:
return 'str'
+2 -2
View File
@@ -1,8 +1,6 @@
from functools import partial
from warnings import warn
import fiona
from fiona.crs import from_epsg
import numpy as np
from pandas import Series, DataFrame
import pyproj
@@ -74,6 +72,7 @@ class GeoSeries(Series):
etc.
"""
import fiona
geoms = []
with fiona.open(filename, **kwargs) as f:
crs = f.crs
@@ -616,6 +615,7 @@ class GeoSeries(Series):
projection, not geodesics. Objects crossing the dateline (or
other projection boundary) will have undesirable behavior.
"""
from fiona.crs import from_epsg
if self.crs is None:
raise ValueError('Cannot transform naive geometries. '
'Please set a crs on the object first.')
+1 -1
View File
@@ -1,7 +1,6 @@
from collections import defaultdict
from shapely.geometry import shape
import fiona
from geopandas import GeoSeries, GeoDataFrame
@@ -17,6 +16,7 @@ def read_file(filename, **kwargs):
Properties that are not present in all features of the source
file will not be properly aligned. This should be fixed.
"""
import fiona
geoms = []
columns = defaultdict(lambda: [])
bbox = kwargs.pop('bbox', None)