mirror of
https://github.com/wassname/geopandas.git
synced 2026-09-17 12:20:25 +08:00
ENH: Protect fiona imports so that they are not required at module level
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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,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)
|
||||
|
||||
Reference in New Issue
Block a user