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

Issue with cc_sea and seas_ref URL #69

Closed jpstevenson2018 closed 2 years ago

jpstevenson2018 commented 2 years ago

I'm running clean_coordinates on a set of data with default test settings and it seems to run the tests fine except for when testing sea coordinates. When it finishes the warning messages read:

> 1: In cc_sea(x, lon = lon, lat = lat, ref = seas_ref, scale = seas_scale,  :
   Gazetteer for land mass not found at
 http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/physical/ne_50m_land.zip
> 2: In cc_sea(x, lon = lon, lat = lat, ref = seas_ref, scale = seas_scale,  :
   Skipping sea test

I went to the website and copied the download address (which only seems to differ by having "https" at the beginning) and tried the following: clean_coordinates(x = data, lon = "Decimal_Long", lat = "Decimal_Lat", species = "Genus_species", seas_ref = "https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/physical/ne_50m_land.zip")

This time it stops with the error:

> Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘proj4string’ for signature ‘"character"’

If I try to run cc_sea on its own it comes up with the same warnings if run with default settings, and the same error if run with the given ref =.

I've looked around but I haven't found anything that can help with this error. Is there a way I can solve this issue and get it to run cc_sea alongside the other tests?

jpstevenson2018 commented 2 years ago

Resolved by downloading a local version of the zip file and reading it into R with:

sea <- st_read("ne_50m_land") sea <- as_Spatial(sea) #convert to SpatialPolygonsDataFrame

and then using this in seas_ref = sea command as part of clean_coordinates().