Description Usage Arguments Details Value References Examples
Prep multiple eBird files into a single KML file.
1 2 3 | prepKMLToFile(files, include, sql.date = FALSE, date.col, coords, early.date,
late.date, handle.early, handle.late, schema, read.wd, write.wd, filename,
cores)
|
files |
Character vector specifying which files from the read.wd to include in the KML output. If missing, will assume all files in read.wd should be included. Full file names (without path) are required. |
include |
Character vector of the columns to include in the prepped KML file. Ideally, these should include a single column or combination of columns that can be used as a unique identifier to match KML records back to csv records later. Also, this function is currently programmed in a rather inflexible manner, and one of the columns needs to be a date, to be specified exactly with the date.col arg. |
sql.date |
Default is FALSE. Set to TRUE if the date is the complex character string that comes directly out of eBIRD SQL database, and will force into suitable format. Otherwise takes date as is. |
date.col |
The name of the date column to use for querying downstream. Likely that some uses of KML files wouldn't need a date column. We should revise this function to be more flexible, and not require a date. |
coords |
Character vector in form c('longitude','latitude'), specifying the names of the columns where the longitude and latitude are contained in the eBird records. |
early.date |
The earliest permissible date to retain in the dataset. Provide as a properly formatted Date object. |
late.date |
The latest permissible date to retain in the dataset. Provide as a properly formatted Date object. |
handle.early |
Set to to 'drop' to exclude records from before early.date. Otherwise, set to a year (i.e. a numeric vector of length one, e.g. '2001'). All records from before early.date will assume the same day and month, but the year will be changed to the provided value. There is a caveat here that if the record in question is from February 29th, it will automatically be shifted to February 28th. |
handle.late |
Set to to 'drop' to exclude records from after late.date. Otherwise, set to a year (i.e. a numeric vector of length one, e.g. '2001'). All records from after late.date will assume the same day and month, but the year will be changed to the provided value. There is a caveat here that if the record in question is from February 29th, it will automatically be shifted to February 28th. |
schema |
Not entirely sure what this does. Ends up getting assigned to a field called 'schemaURL' in the resulting KML file. |
read.wd |
Path to the read directory, where the files to be prepped are found. All files in the directory will be bound together and turned into a single KML. |
write.wd |
Path to the write directory. CRITICAL: DO NOT USE THE ~ SYMBOL IN YOUR WRITE.WD OR THE FUNCTION WILL FAIL WITH A MYSTERIOUS ERROR. |
filename |
Desired name for the output kml file. The file appendix is not needed. |
cores |
How many cores to use for parallel processing. |
This function is rather inflexible and currently intended to convert a set of eBird records from csv files into a single KML file. That file can then be loaded into Google as a Fusion Table, which is then fed into a Google Earth Engine script written by Matt Strimas-Mackey. This script can match records by date and location to spatial data, e.g., MODIS reflectances. There currently is no version of this function that doesn't write results directly to file. For reasons I do not understand, this function generates a warning at the end that seems like it can be ignored.
Nothing to the workspace. A file titled output.kml is written to the write.wd.
Team eBird.
1 2 3 4 5 6 7 8 | #NOT RUN. this will prep a series of CSV files for querying with the MODIS/MCD43A4
#dataset. useful for subsequent querying with a Google Earth Engine script by
#Matt Strimas-Mackey.
#prepKML(include=c("SUB_ID", "SCI_NAME", "OBS_DT", "LONGITUDE", "LATITUDE"),
#date.col="OBS_DT", coords=c("LONGITUDE","LATITUDE"),
#early.date=as.Date("2000-02-18"), late.date=as.Date("2017-03-22"),
#handle.early="2001", handle.late="2016", schema="test",
#read.wd="~/thinned", write.wd="~/kml", cores=6)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.