ropensci / CoordinateCleaner

Automated flagging of common spatial and temporal errors in biological and palaeontological collection data, for the use in conservation, ecology and palaeontology.
https://docs.ropensci.org/CoordinateCleaner/
79 stars 21 forks source link

[Suggested]: Test countries using ISO2 Codes instead of ISO3 #25

Closed jivelasquezt closed 4 years ago

jivelasquezt commented 5 years ago

The above suggestion emerges from the fact that GBIF data comes already with ISO2 codes in their field countryCodes, but to use cc_coun function on GBIF data you would need to lookup their respective ISO3 codes in order to properly run it. If most users use CoordinateCleaner on GBIF data, ISO2 would be a straightforward default for cc_coun.

azizka commented 5 years ago

Hi, thanks for the suggestion. We experimented with this. The problem is Namibia (ISO-2: NA) which can (and in my experience will) lead to confusion with "Not available" values, which relatively often can end up as "NA". So, I prefer to stick with the more specific ISO-3. OK?

tretherington commented 4 years ago

I was going to make the same suggestion. We can specify the column for the code in the dataframe of occurrences, so perhaps a solution is to be able to specify the name of column in the SpatialPolygonsDataFrame as well rather than assuming it will be "iso_a3_eh". This would allow users to work with want they want, and I think might resolve this issue as users could always manually specify the column name if the underlying country SpatialPolygonsDataFrame column names change.

pepbioalerts commented 4 years ago

Hey Alexander, just a suggestion. When running cc_outl the issue I am finding is that using ISO3 codes need will not work with gbif::occ_count(country = k) that seems to use 2-digit code, but we are using area <- data.frame(country = ref@data$iso_a3, area = geosphere::areaPolygon(ref)) Just chaining that line to ref@data$iso_a2 in that sentence seems to make it work while then you can continue with your ISO3 (which I also like better).

azizka commented 4 years ago

Good idea. I added an ref_col argument to cc_coun to customize the amtching column in the reference dataset,a s of version 2.0-14