def reproject(dataset, epsg): """ Reproject a dataset to the specified EPSG code :param dataset: Dataset to reproject :param epsg: EPSG code to reproject to :return: Reprojected data """ dataclass = dataset.__class__.__name__ # Run appropriate reprojection method if dataclass == 'GeoDataFrame': repro = geopandas.GeoDataFrame.copy(dataclass) repro[repro.geometry.name] = repro.geometry.to_crs(epsg=epsg) repro.crs = fiona.crs.from_epsg(epsg) elif dataclass == 'Dataset': repro = gdal_reproject(dataset, '', epsg=epsg) return repro
def reproject(self, epsg): self._data = gdal_reproject(self._data, '', epsg=epsg) self.epsg = epsg