LandSciTech / ccviR

Implement NatureServe climate change vulnerability index in R
https://landscitech.github.io/ccviR/
Other
2 stars 1 forks source link

Accept points or other formats for range input? #116

Open adricaswell opened 5 months ago

adricaswell commented 5 months ago

Point shapefile can be input into Spatial Data Analysis (tested on Range polygon shapefile) without warning user that the wrong data type has been input. Spatial data analysis is run with the following warning and error messages:

image

It took several minutes for the spatial analysis to run. The warning message is not communicated to the user in the app so it was not clear as to why it was taking so long.

Suggestion: Screen inputs to ensure correct data type (polygon) is being input. Communicate with the user if the wrong data type is input or as soon as the spatial analysis is run. Stop spatial analysis immediately if wrong data type is input to prevent wasted time and confusion.

see24 commented 5 months ago

Having the ability to use points is potentially useful. Did the results make sense when you did that? If for example the points represent all the occurrences of the species that are known then they could be used what is used to extract data from the raster. But this would change the interpretation of the raster extraction since area of the polygon is used in that calculation.

I am adding a bug label because this needs fixing but will leave enhancement as well since supporting points is an enhancement

adricaswell commented 5 months ago

Correction - the point data used was not within the assessment area which is why the above error message occurred. When run with point data (for range) within the assessment area the error message does indicate the wrong data type was input - see below:

image

However, this message only occurred 8-10 minutes after spatial analysis was initiated. Screening for appropriate data type should be done before "union of polygons" so that user is notified as soon as spatial analysis is iniciated.

see24 commented 4 months ago

I added the error message and a test to make sure this works as expected. I am changing the name and labels to reflect the ongoing enhancement idea of supporting other formats for the range input probably points and rasters would be nice. But we would need to think through what the best way to do that would be. Do we just intersect the points with the climate rasters? That would follow a very conservative assumption that the species only exists where we have points. Another option would be to use a convex hull but that could potentially include large unsuitable areas. or an in between might create contours around points or a simple buffer... Basically there are a lot of scientific considerations and the right answer will probably depend on the data set that the points come from.

Rasters would be easier assuming they are binary and represent the species range as opposed to point occurrences with in the cell. Will wait to see if this use case actually comes up

see24 commented 1 month ago

Would be super cool if we could also facilitate pulling those points from external sources eg GBIF but this would be a big extension of capabilities and would need to be done carefully so that GBIF data is treated with care since it can contain errors