isciences / exactextract

Fast and accurate raster zonal statistics
Apache License 2.0
233 stars 31 forks source link

Check input layer CRS #108

Open dbaston opened 2 months ago

dbaston commented 2 months ago

exactextract currently does not check the CRS of its inputs for consistency, although it has access to this information in the form of WKT strings.

The exactextractr package automatically reprojects the vector layer to the CRS of the raster, but this may introduce large errors. For example, the dataset discussed in https://discourse.pangeo.io/t/advice-for-scalable-raster-vector-extraction/4129/18 contains a dataset of protected areas in US Albers Conic:

image

which is to be used to extract values from a dataset in a Mollweide projection. The reprojected polygons look like:

image

which is clearly not a desirable result. Possible behaviors for exactextract:

theroggy commented 1 month ago

Additional option: raise a warning if the input's projections are not equivalent, but then just calculate. So current behaviour, but add warning...