Example #1
0
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
Example #2
0
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
Example #3
0
 def _geometry(self):
     return com._check_package('shapely.geometry')
Example #4
0
 def _spatial(self):
     return com._check_package('scipy.spatial')
Example #5
0
 def _np(self):
     return com._check_package('numpy')
Example #6
0
 def __init__(self, name):
     plt = com._check_package('matplotlib.pyplot')
     self.name = name
     self.cm = plt.get_cmap(name)