infile <- "western_sydney_passive_samplers_site_details.csv"
indir <- "data_derived"
outdir <- indir
outfile <- file.path(outdir, gsub(".csv",".shp",infile))
dat <- read.csv(file.path(indir, infile), as.is=T)
str(dat)
dat2 <- SpatialPointsDataFrame(data.frame(x=dat$long, y=dat$lat), dat,
proj4string=CRS(epsg$prj4[epsg$code %in% '4283'])
)
writeOGR(dat2, outfile,
outdir, driver='ESRI Shapefile'
)
# fix the prj file
download.file("http://spatialreference.org/ref/epsg/4283/prj/",
gsub(".shp", ".prj", outfile), mode = "wb"
)