exactextract
exactextract copied to clipboard
Check input layer CRS
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:
which is to be used to extract values from a dataset in a Mollweide projection. The reprojected polygons look like:
which is clearly not a desirable result. Possible behaviors for exactextract:
- do nothing, assume the inputs are in the proper CRS, and that the user will notice the incorrect values if they are not (current bevhavior)
- raise an error if projections are not equivalent. This is likely to cause annoying false alarms through slight differences between the specification of projections that are functionally equivalent within the scale of the analysis being performed
- automatically reproject polygons and raise a warning (the behavior of exactextractr)
- automatically reproject polygons and perform some sort of sanity check on the results to prevent situations such as the one shown above