file <- '/Users/scottmac2/Downloads/taxon-placemarks-2441176.kml'
# KML type file - using the web method
togeojson(file, method='web', outfilename="kml_web")
# KML type file - using the local method
togeojson(file, method='local', outfilename="kml_local")
# Shp type file - using the web method - input is a zipped shp bundle
file <- '~/github/sac/bison.zip'
togeojson(file, method='web', outfilename="shp_web")
# Shp type file - using the local method - input is the actual .shp file
file <- '~/github/sac/bison/bison-Bison_bison-20130704-120856.shp'
togeojson(file, method='local', outfilename="shp_local")
# Get data and save map data
splist <- c('Accipiter erythronemius', 'Junco hyemalis', 'Aix sponsa')
keys <- sapply(splist, function(x) name_backbone(name=x, kingdom='plants')$speciesKey,
USE.NAMES=FALSE)
out <- occ_search(keys, georeferenced=TRUE, limit=50, return="data")
dat <- ldply(out)
datgeojson <- stylegeojson(input=dat, var="name", color=c("#976AAE","#6B944D","#BD5945"),
size=c("small","medium","large"))
# Put into a github repo to view on the web
write.csv(datgeojson, "~/github/sac/mygeojson/rgbif_data.csv")
file <- "~/github/sac/mygeojson/rgbif_data.csv"
togeojson(file, method="web", destpath="~/github/sac/mygeojson/", outfilename="rgbif_data")
# Using rCharts' function create_gist
write.csv(datgeojson, "~/my.csv")
file <- "~/my.csv"
togeojson(input=file, method="web", outfilename="my")
create_gist("~/my.geojson", description = "Map of three bird species occurrences")
Run the code above in your browser using DataLab