-
Notifications
You must be signed in to change notification settings - Fork 385
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
RasterDataset: res does not change when crs changes #2190
Comments
Thanks for the code to reproduce, this is extremely useful! Looking into this now. Discoveries I've made so far:
|
Current workaround is to specify the resolution yourself: naip = NAIP(naip_root, crs="EPSG:4326", res=6.052321988618891e-06) Let me see if I can figure out how to compute the new resolution automatically. |
For RasterDataset, I think the ideal situation (depending on user input) would be:
The only thing we're currently missing is "calculate res", which led to the issue you saw. Note that this does not apply to |
Another related bug is that changing the CRS after initialization also doesn't update res (not sure if it should though): naip = NAIP(naip_root)
print(naip.crs, naip.res)
naip.crs = "EPSG:4326"
print(naip.crs, naip.res) # crs changed, but not res |
I will probably ignore this related bug until someone complains about it. I don't know off the top of my head how to compute resolution in the new coordinate system, and it seems like it depends on the location, which we know for a single image, but not for the entire R-tree. |
Perhaps there shouldn't be a recalculation in this case, but using |
I just don't know how to tell if the resolution is invalid. |
Any change from a Cartesian to an angular crs? |
But what range of resolutions are valid for Cartesian and what range of resolutions are valid for angular? |
For any resolution for a cartesian crs, there is no simple analogue in a angular crs, right? i.e. def set_crs(self, crs):
old_crs = self.crs
self.crs = crs
old_system = old_crs.coordinate_system.name
new_system = self.crs.coordinate_system.name
if old_system == "cartesian" and new_system == "ellipsoidal":
self.res = None |
Note to self: I'm a little worried about I think I'm still leaning towards ignoring this until someone complains, but I could be persuaded. |
Happy with your decision to ignore this, but in case you come back to it some day, the check could be for units in the CRS.from_epsg(32631).units_factor
# ('metre', 1.0)
CRS.from_epsg(4326).units_factor
# ('degree', 0.017453292519943295) |
Description
It is possible to create an invalid combination of
GridGeoSampler
andRasterDataset
. This is because.res
can be in units which do not match the CRS, specifically when the CRS is angular (e.g. EPSG:4326) rather than a planar grid.It seems like this was somewhat known when pixel space sizes was introduced (#279 (comment)).
I think these are the relevant lines
Steps to reproduce
Version
0.5.2
The text was updated successfully, but these errors were encountered: