Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def load_vector(self, filename):
"""Load source/target grid points/polygons into in-memory Shapefile
Parameters
----------
filename : string
path to vector file
"""
self.src = DataSource(filename, name='src', source='src')
self.trg = DataSource(filename, name='trg', source='trg')
self.dst = DataSource(filename, name='dst', source='dst')
# get spatial reference object
self._srs = self.src.ds.GetLayer().GetSpatialRef()
def __init__(self, src, trg=None, buf=0., srs=None, **kwargs):
self._buffer = buf
self._srs = srs
silent = kwargs.pop('silent', False)
if trg is None:
# try to read complete dump (src, trg, dst)
self.load_vector(src)
else:
if isinstance(src, DataSource):
self.src = src
else:
self.src = DataSource(src, name='src', srs=srs, **kwargs)
if isinstance(trg, DataSource):
self.trg = trg
else:
self.trg = DataSource(trg, name='trg', srs=srs, **kwargs)
self.dst = DataSource(name='dst')
self.dst.ds = self._create_dst_datasource(silent)
self.dst._create_spatial_index()
self.dst._create_table_index('trg_index')
self._count_intersections = self.dst.ds.GetLayer().GetFeatureCount()
if trg is None:
# try to read complete dump (src, trg, dst)
self.load_vector(src)
else:
if isinstance(src, DataSource):
self.src = src
else:
self.src = DataSource(src, name='src', srs=srs, **kwargs)
if isinstance(trg, DataSource):
self.trg = trg
else:
self.trg = DataSource(trg, name='trg', srs=srs, **kwargs)
self.dst = DataSource(name='dst')
self.dst.ds = self._create_dst_datasource(silent)
self.dst._create_spatial_index()
self.dst._create_table_index('trg_index')
self._count_intersections = self.dst.ds.GetLayer().GetFeatureCount()
def load_vector(self, filename):
"""Load source/target grid points/polygons into in-memory Shapefile
Parameters
----------
filename : string
path to vector file
"""
self.src = DataSource(filename, name='src', source='src')
self.trg = DataSource(filename, name='trg', source='trg')
self.dst = DataSource(filename, name='dst', source='dst')
# get spatial reference object
self._srs = self.src.ds.GetLayer().GetSpatialRef()
self._srs = srs
silent = kwargs.pop('silent', False)
if trg is None:
# try to read complete dump (src, trg, dst)
self.load_vector(src)
else:
if isinstance(src, DataSource):
self.src = src
else:
self.src = DataSource(src, name='src', srs=srs, **kwargs)
if isinstance(trg, DataSource):
self.trg = trg
else:
self.trg = DataSource(trg, name='trg', srs=srs, **kwargs)
self.dst = DataSource(name='dst')
self.dst.ds = self._create_dst_datasource(silent)
self.dst._create_spatial_index()
self.dst._create_table_index('trg_index')
self._count_intersections = self.dst.ds.GetLayer().GetFeatureCount()
def load_vector(self, filename):
"""Load source/target grid points/polygons into in-memory Shapefile
Parameters
----------
filename : string
path to vector file
"""
self.src = DataSource(filename, name='src', source='src')
self.trg = DataSource(filename, name='trg', source='trg')
self.dst = DataSource(filename, name='dst', source='dst')
# get spatial reference object
self._srs = self.src.ds.GetLayer().GetSpatialRef()
def __init__(self, src, trg=None, buf=0., srs=None, **kwargs):
self._buffer = buf
self._srs = srs
silent = kwargs.pop('silent', False)
if trg is None:
# try to read complete dump (src, trg, dst)
self.load_vector(src)
else:
if isinstance(src, DataSource):
self.src = src
else:
self.src = DataSource(src, name='src', srs=srs, **kwargs)
if isinstance(trg, DataSource):
self.trg = trg
else:
self.trg = DataSource(trg, name='trg', srs=srs, **kwargs)
self.dst = DataSource(name='dst')
self.dst.ds = self._create_dst_datasource(silent)
self.dst._create_spatial_index()
self.dst._create_table_index('trg_index')
self._count_intersections = self.dst.ds.GetLayer().GetFeatureCount()