Skip to content

Commit

Permalink
Fix #117, implement identify tool for v3.22
Browse files Browse the repository at this point in the history
  • Loading branch information
gena committed Jan 5, 2023
1 parent f4a690b commit 2be5068
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 23 deletions.
32 changes: 9 additions & 23 deletions provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ def getLegendGraphicUrl(self):
def clone(self):
provider = EarthEngineRasterDataProvider(*self._args, **self._kwargs)
provider.wms.setDataSourceUri(self.wms.dataSourceUri())
provider.set_ee_object(self.ee_object)
provider.setParent(EarthEngineRasterDataProvider.PARENT)

return provider
Expand All @@ -345,29 +346,14 @@ def sourceDataType(self, band_no):
return self.wms.sourceDataType(band_no)

def bandCount(self):
return self.wms.bandCount()

# def dataType(self, band_no):
# if not self.ee_object:
# return self.wms.dataType(band_no)

# return self.sourceDataType(band_no)

# def sourceDataType(self, band_no):
# if self.ee_object:
# print(f'sourceDataType: {BAND_TYPES[self.ee_info["bands"][band_no - 1]["data_type"]["precision"]]}')
# return BAND_TYPES[self.ee_info['bands'][band_no - 1]['data_type']['precision']]
# else:
# print(f'sourceDataType2: {self.wms.sourceDataType(band_no)}')
# return self.wms.sourceDataType(band_no)

# def bandCount(self):
# if self.ee_object:
# print(f'bandCount: {len(self.ee_info["bands"])}')
# return len(self.ee_info['bands'])
# else:
# return 1 # fall back to default if ee_object is not set

if self.ee_object:
return len(self.ee_info['bands'])
else:
return 1 # fall back to default if ee_object is not set

def generateBandName(self, band_no):
return self.ee_info['bands'][band_no - 1]['id']

def xBlockSize(self):
return self.wms.xBlockSize()

Expand Down
2 changes: 2 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def get_ee_image_url(image):


def update_ee_layer_properties(layer, eeObject, visParams, shown, opacity):
layer.dataProvider().set_ee_object(eeObject)

layer.setCustomProperty('ee-layer', True)

if not (opacity is None):
Expand Down

0 comments on commit 2be5068

Please sign in to comment.