To me there are really 2 unrelated questions here.
A) What is the projection of my shapefile and how can I merge/plot it with another layer.
B) What is the form of these raster data, and why are there in a table when they could actually be a grid?
There's a lot of possibilities here and not enough to go on. I'd like to know the answers to these:
I would find out the projection of the shapefile, and you cannot do that with maptools::readShapeLines.
1) read it with rgdal
and transform:
library(rgdal)
ned.lines <- readOGR("d:/readShapefiles", "NLD_adm/NLD_adm1")
## this will tell you what the projection is
## find out and tell us
proj4string(ned.lines)
You might find this makes it work with your grid data, but there's a lot of guessing here:
plot(spTransform(ned.lines, CRS("+proj=longlat +datum=WGS84")))
2) Find out the actual projection and get back to us, you might need this if you cannot install rgdal.
readLines("d:/readShapefiles/NLD_adm/NLD_adm1.prj")
(Note that this is reading text lines, not geometry).
If that fails because the file doesn't exist, then there's only more guesses we can do. It looks like you don't have a grid of the radar data, so I would go back to the source and get an actual grid, or you'll need to rasterize the data from the irregular points.
The problem is that col.regions expects a vector with values or names for colors and you are giving it factors. When you build your dataframe your string vectors are (by default) turned into factors and the levels of the factors are (by default) ordered, in this case alphabetically. This is the reason why the mapping of the colors to the categories is off. In order to allow a correct color mapping for multiple categories, I would suggest the following.
# create a table to map colors to geo-categories
lookupTable <- unique(df)
# match the different geo-categories with the lookup table
# and retrieve the corresponding color value into a vector
colRegions <- as.vector(lookupTable$col[match(levels(SpDF$GEOLOGY), lookupTable$GEOLOGY)])
# then use it to plot
spplot(SpDF, zcol = "GEOLOGY", col.regions = colRegions)
Best Answer
You are not telling the function which attribute to plot, you can do this with a bracket
plot(UpCarson["tnmid"])
If you don't need the plot symbolized by an attribute you can simply call the geometryplot(st_geometry(UpCarson))