Commit 3eefe7d1 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Fixed metadata setter. Removed deprecated code.

parent b9b19c2a
Pipeline #3074 failed with stages
in 1 minute and 20 seconds
......@@ -516,11 +516,12 @@ class GeoArray(object):
return self._metadata
def metadata(self, GDF):
assert isinstance(GDF, (GeoDataFrame, DataFrame)) and len(GDF.columns) == self.bands, \
"%s.metadata can only be set with an instance of geopandas.GeoDataFrame of which the column number " \
"corresponds to the band number of %s." % (self.__class__.__name__, self.__class__.__name__)
self._metadata = GDF
def metadata(self, meta):
if not isinstance(meta, GDAL_Metadata) or meta.bands != self.bands:
raise ValueError("%s.metadata can only be set with an instance of geoarray.metadata.GDAL_Metadata of "
"which the band number corresponds to the band number of %s."
% (self.__class__.__name__, self.__class__.__name__))
self._metadata = meta
meta = alias_property('metadata')
......@@ -43,18 +43,6 @@ class GDAL_Metadata(object):
def from_file(cls, filePath):
return GDAL_Metadata(filePath=filePath)
def from_DataFrame(cls, dataframe):
# type: (GeoDataFrame) -> 'GDAL_Metadata'
if dataframe.empty:
raise ValueError('DataFame must not be empty.')
GDMD = GDAL_Metadata(nbands=dataframe.shape[1])
GDMD.df = dataframe
return GDMD
def to_DataFrame(self):
df = GeoDataFrame(columns=range(self.bands))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment