CropTypeClassification Example Error : DownloadFailedException: During execution of task AddGeopediaVectorFeature

I encounter this HTTP error while working off an example notebook called “CropTypeClassification_Workflow”.
Screenshots and details are in this github issue: [HELP] DownloadFailedException: During execution of task AddGeopediaVectorFeature · Issue #314 · sentinel-hub/eo-learn · GitHub
basically it shows:

DownloadFailedException: During execution of task AddGeopediaVectorFeature: Failed to download from:
http://www.geopedia.world/rest/data/v2/search/tables/2647/features?offset=1000&limit=1000
with HTTPError:
405 Client Error: Method Not Allowed for url: https://www.geopedia.world/rest/data/v2/search/tables/2647/features?offset=1000&limit=1000
Server response: "No resource method found for GET, return 405 with Allow header"

trying to access the endpoint on by own I also get return 405,
Is this the problem from Geopedia API | Geopedia Portal, that they have changed their endpoints or what do I have to do to resolve this?

Hi @natthadechmani,

It turns out there is an issue with Geopedia REST API in the latest deployment of Geopedia. Our developers are working to fix it.

Thanks for reporting this. We’ll let you know when it is fixed.

1 Like

Hi thank you very much, do you know how long it would take?

I can’t say for sure, but probably max few days.

In case you need a solution right now, there is a “quick and dirty” fix that you can do on your side. In your installation of sentinelhub Python package you can change this line into:

self.next = pagination.get('next', '').replace('http://', 'https://')

The problem is that this pagination is obtained from Geopedia and it incorrectly returns http instead of https.

Hi, I have tried to change that but still got an error,

~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/site-packages/sentinelhub-3.3.2-py3.6.egg/sentinelhub/geopedia.py in _fetch_features(self)
    391 
    392         self.layer_size = pagination.get('total')
--> 393         self.next = pagination.get('next', '').replace('http://', 'https://')
    394 
    395         if not self.next or not new_features:

AttributeError: During execution of task AddGeopediaVectorFeature: 'NoneType' object has no attribute 'replace'

Hm, looks like pagination can be a dictionary with None for a value. Then perhaps this:

self.next = pagination.get('next')

if self.next:
    self.next = self.next.replace('http://', 'https://')

Update on the proper fix on Geopedia: it should be deployed to production either in next few hours or tomorrow.

Thank you very much :blush:

Update: The issue has now been properly fixed on Geopedia. Hence, it will work even without this fix in sentinelhub package.

Thank you, it is working now :slight_smile: