I am trying to geocode a dataset using the given latitude and longitude. I am then going to use these points and join polygon features to them. However, the projection I am using for the points is incorrect. How do I go about this in a better more efficient way?
I begin by uploading the files and setting the projection. The polygon file I have already has a projection so I used that projection for the points.
fema <- readOGR(paste(fema.path, "/2010_DFIRM.shp", sep=""))
fema@proj4string
#CRS arguments:
#+proj=lcc +lat_1=30.28333333333333 +lat_2=28.38333333333333
#+lat_0=27.83333333333333
#+lon_0=-99 +x_0=600000 +y_0=3999999.9998984 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0
#+units=us-ft +no_defs
data <- read.table(paste(inf.path, "/samp_HT_ANALYSIS", sep = ""), sep=",", fill=T)
coords <- data[,c(22:23)]
data.sp <- SpatialPointsDataFrame(data = data, coords = coords, proj4string =
CRS("+proj=lcc +lat_1=30.28333333333333 +lat_2=28.38333333333333 +lat_0=27.83333333333333 +lon_0=-99 +x_0=600000 +y_0=3999999.9998984 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs"))
However, when I do the spatial join using the following code...
test <- over(data.sp, fema, returnList = T)
No attributes overlap with my points.
I went on to map the points in ArcMap with a base layer map and they aren't mapped at all on the plane. Can someone please explain how I can solve this? Also, general information on projections in R would be great. I thought I could just set the CRS equal of one file equal to the other but I may have to reproject all of my files.