I have been following this example: https://eo-learn.readthedocs.io/en/latest/examples/io/SentinelHubIO.html
It works fine but when I change the line
roi_bbox = BBox(bbox=[5.60, 52.68, 5.75, 52.63], crs=CRS.WGS84)
to
roi_bbox = BBox(bbox=[1475000.0, 5100000.0, 1495000.0, 5120000.0], crs=CRS(‘2193’))
there are no available images found. My guess is that CRS(‘2193’) which is NZGD2000 / New Zealand Transverse Mercator 2000 is not compatible.
Although on this page https://docs.sentinel-hub.com/api/latest/api/process/crs/ its listed in the ‘other’ section. Can I not use this CRS format?
The error message I get is:
ValueError: During execution of task SentinelHubInputTask: No available images for requested time range: (datetime.datetime(2018, 4, 1, 0, 0), datetime.datetime(2018, 5, 1, 23, 59, 59))
Thanks for your response maleksandrov.
I am getting confused here, I see what you are saying, it does drop the WGS84 coordinates into the ocean - well away from the original location. But is there something wrong with the conversion as the original coordinates are just off the coast of New Zealand. See image
the original coordinates transform to 171.434508, -44.2425095 (not -118.79345083627057, -57.54181875157152). Is there something wrong with the BBox.transform?
This produces the same wrong result (BBox.transform just makes sure to use lng-lat order instead of the default lat-lng). I tried running this code with the latest pyproj version 3.1.0 and an older 2.2.0 version and in both cases got the same result.
Hence, pyproj has a wrong/different interpretation of some less common CRS. I can even confirm we recently noticed a similar pyproj issue with a different CRS (EPSG:3346). Probably it is worth opening an issue at pyproj repository.
I investigated the issue further and it seems that is actually this issue. Adding the parameter always_xy=True to transformer initialization solves the problem and correctly transforms coordinates to
171.43450807766266, -44.242509416017654
Therefore, it seems that we have to start using this parameter also in sentinelhub-py. This will be fixed in the next release.
The fix for this has just been released in the new sentinelhub-py version 3.3.2.
In sentinelhub-py transformation methods and functions we now have an optional always_xy which is by default set to True but users can change that. The default option seems to work correctly for all our use cases.