Hi,
Here is a snippet that demonstrates why the issue happens:
import pyproj
import sentinelhub
lat_lng_def = pyproj.CRS(4326)
lng_lat_def = sentinelhub.CRS.WGS84.pyproj_crs()
# the following works
sentinelhub.CRS(lng_lat_def)
# the following raises an error
sentinelhub.CRS(lat_lng_def)
Basically, in sentinelhub-py
we use lng-lat coordinate order and in pyproj
by default lat-lng order is used. Therefore sentinelhub-py
raises an error whenever pyproj.CRS(4326)
would be converted in sentinelhub.CRS.WGS84
to prevent potential mismatches in coordinate order.
I don’t know how you pass a CRS parameter to sentinelhub-py
but I suggest that instead of pyproj.CRS(4326)
you simply use sentinelhub.CRS.WGS84
.
In the future, we intend to change the error into a warning. That is because many packages (e.g. geopandas
) use pyproj.CRS(4326)
but internally interpret coordinates with order lng-lat. Therefore, in such cases a conversion could still be ok.
Thanks for the clarification and quick response…that address the problem perfectly!
Hi,
Can you help me here. I am facing with the saem issue whe I try creating the bbox splitter
bbox_splitter = UtmZoneSplitter([country_shape], country.crs, 5000)
When I try to run this command I come up with this error,
ValueError: sentinelhub-py supports only WGS 84 coordinate reference system with coordinate order lng-lat. However pyproj.CRS(4326) has coordinate order lat-lng
Can you help me resolve this issue?
Hi,
There are 2 quick fix options:
- replace
country.crs
with sentinelhub.CRS.WGS84
, - upgrade
sentinelhub
package to version 3.1.0
, where this will only show a warning instead of raising an error.
Also check my answer above for an explanation of the issue.
sentinelhub.CRS.WGS84
,
When I tried this I am getting the following Error.
ValueError: The list of shapes must contain shapes of types <class ‘type’>, <class ‘type’> or subtype of <class ‘abc.ABCMeta’>
Thanks a lot!!!
It is working fine.