Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RasterInterfaceCapabilities error #151

Closed
JSS2000 opened this issue Aug 12, 2024 · 10 comments
Closed

RasterInterfaceCapabilities error #151

JSS2000 opened this issue Aug 12, 2024 · 10 comments
Assignees

Comments

@JSS2000
Copy link

JSS2000 commented Aug 12, 2024

Hi,
I am tring to fix that error:
TypeError: invalid result from EarthEngineRasterDataProvider.capabilities(), RasterProviderCapabilities cannot be converted to qgis._core.RasterInterfaceCapabilities in this context

My QGIS version is : 3.38 and GEE plugin is 0.6.

Someone has some clue?

@XavierCLL
Copy link
Collaborator

Hi @JSS2000, could you share the code or part of it to test it?

@JSS2000
Copy link
Author

JSS2000 commented Aug 13, 2024

Hi, @XavierCLL . That is the code:

Centraliza o mapa

Map.setCenter(-8.014008631440426, 38.5333478267441, 20)

Carregar a coleção de imagens Sentinel-2 e filtrar pela área de interesse

image = ee.ImageCollection("COPERNICUS/S2").filterBounds(center).first(); # Selecionar a primeira imagem da coleção

Defina o caminho do asset do seu polígono no GEE

tailao_asset = 'projects/ee-ndvieto/assets/mitra1' # Substitua pelo seu caminho de asset do GEE

Carregar a coleção de polígonos como um FeatureCollection

tailao = ee.FeatureCollection(tailao_asset)

Faça o clip da imagem com o polígono

imagem_clipada = image.clipToCollection(tailao)

Calcular o NDVI

ndvi = imagem_clipada.normalizedDifference(['B8', 'B4']).rename('NDVI')

Adicionar a camada NDVI ao mapa

Map.addLayer(ndvi, {min: -1, max: 1, palette: ['blue', 'white', 'green']}, 'NDVI')

Exportar o NDVI para o Google Drive (ou outro serviço) se desejar, caso precise baixar

Export.image.toDrive({
image: ndvi,
description: 'NDVI_Clipado',
scale: 10,
region: tailao
})

@JSS2000
Copy link
Author

JSS2000 commented Aug 13, 2024

other code:

Map.setCenter(-8.014008631440426, 38.5333478267441, 20)
image = ee.ImageCollection("COPERNICUS/S2").filterBounds(Map.getCenter()).first()
Map.addLayer(image, {'bands': 'B4,B3,B2', 'min': 0, 'max': 5000, 'gamma': 1.4}, 'RGBTrueColor')
tailao_asset = 'projects/ee-ndvieto/assets/mitra1' # Substitua pelo seu caminho de asset do GEE
tailao = ee.FeatureCollection(tailao_asset)
imagem_clipada = image.clipToCollection(tailao)
Map.addLayer(imagem_clipada, {'bands': 'B4,B3,B2', 'min': 0, 'max': 5000, 'gamma': 1.4}, 'Imagem Clipada Tailao')

@XavierCLL
Copy link
Collaborator

I couldn't test completely because 'projects/ee-ndvieto/assets/mitra1' does not exist, but this code that is part of your code works for me:

import ee
from ee_plugin import Map
ee.Initialize()
Map.setCenter(-8.014008631440426, 38.5333478267441, 20)
image = ee.ImageCollection("COPERNICUS/S2").filterBounds(Map.getCenter()).first()
ndvi = image.normalizedDifference(['B8', 'B4']).rename('NDVI')
Map.addLayer(ndvi, {'min': -1, 'max': 1, 'palette': ['blue', 'white', 'green']}, 'NDVI')

most likely you have an issue with your code

@JSS2000
Copy link
Author

JSS2000 commented Aug 14, 2024

I run the code like yours and return same error with added lines:
TypeError: EarthEngineRasterDataProvider.readNativeAttributeTable() missing 1 required positional argument: 'errorMessage'

Maybe is some python library in fault.

@XavierCLL
Copy link
Collaborator

That was fixed in #140 but has not been released yet, but for now you can use this #133 (comment) zip with the fixes

@JSS2000
Copy link
Author

JSS2000 commented Aug 16, 2024

Thank you, @XavierCLL . Indeed, it has been corrected. However, that error , continue : TypeError: invalid result from EarthEngineRasterDataProvider.capabilities(), RasterProviderCapabilities cannot be converted to qgis._core.RasterInterfaceCapabilities in this context . What is the QGIS version that you have used to run that code?

@XavierCLL
Copy link
Collaborator

@JSS2000 error confirmed, I usually use a lts version but with the latest version of Qgis 3.38 capabilities() need to be updated, I'm going to fix it, thanks!

@XavierCLL
Copy link
Collaborator

fixed, test with this:
ee_plugin.zip

@JSS2000
Copy link
Author

JSS2000 commented Aug 19, 2024

Thank you, @XavierCLL with that upgrade , works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants