Closed tombatter closed 7 years ago
The answer is to avoid using the readr::read_csv function to read in your csv. I added an explanation in the code and in the Discussion repo, and updated my Rmd from today...check it out. This code worked for me, give it a shot:
LPBBull <- read.csv("https://raw.githubusercontent.com/gge-ucd/wRangling_Seminar/master/data/GIS/LPB_762B_20170302.csv")
head(LPBBull)
LPBBull%>% filter(is.na(Latitude)) %>% tally #how many NA in lat
LPBBull%>% filter(is.na(Longitude)) %>% tally #how many NA in long
LPBBull%>% filter(is.na(Altitude)) %>% tally
LPBBull <- LPBBull %>% filter(!is.na(Latitude)) # filter out NA's
LPBBull.Sp <- SpatialPointsDataFrame(coords = LPBBull[, c("Longitude","Latitude")], data = LPBBull) # coords need to be x, y
lats <-CRS("+init=epsg:4326")
proj4string(LPBBull.Sp) <- lats # assign the CRS
raster::crs(LPBBull.Sp) # check CRS
writeOGR(LPBBull.Sp, dsn = "data/LPBBull", layer = "LPBBull_points", driver="ESRI Shapefile")
awesome, that worked! thank you!
Hey @ryanpeek I am trying to repeat what we did today with my elk data... I am getting the following error when i try to execute the writeOGR command:
can you have a look at my code in LPBBull_test ? thanks!