def read_shape(path): sp = com._check_package('shapely.geometry') fiona = com._check_package('fiona') results = [] with fiona.open(path) as f: for shape in f: shape = sp.shape(shape['geometry']) result = to_entity(shape) if isinstance(result, list): results.extend(result) else: results.append(result) return results
def read_geojson(path): sp = com._check_package('shapely.geometry') with open(path) as f: geos = json.load(f) # shapely can't parse featurecollection directly results = [] for feature in geos['features']: shape = sp.shape(feature['geometry']) result = to_entity(shape) if isinstance(result, list): results.extend(result) else: results.append(result) return results
def _geometry(self): return com._check_package('shapely.geometry')
def _spatial(self): return com._check_package('scipy.spatial')
def _np(self): return com._check_package('numpy')
def __init__(self, name): plt = com._check_package('matplotlib.pyplot') self.name = name self.cm = plt.get_cmap(name)