Situation:
I have two spatial data frames, one of type polygon (areas with different average wind speed levels) and one of type point (wind mills).
I read the polygon shapefile with readOGR, the points were imported as csv and I added coordinates and a projection to it.
What I have:
I use the function over() from the sp-package in combination with summary to determine how many wind mills are placed in areas of each category of average wind speed. Afterwards, I can compare this distribution to the general distribution of wind speed levels and get some kind of result.
Question:
I want a plot that visualizes the relationship between the positions of the wind mills and the wind speed levels. (So hopefully see that wind mills are preferably placed in polygons with high wind speed.) How can I accomplish this?
library('raster')
library('rgeos')
library('sp')
library('rgdal')
polygons = readOGR(dsn = "./North_South_Dakota_Wind_High_Resolution", layer = "ndsd_50mwind")
wind_mills = read.csv('NDGISHubData/NDHUB_WINDTURBINES.csv')
# Assignment modified according
coordinates(wind_mills) <- ~ LONGITUDE + LATITUDE
# Set the projection of the SpatialPointsDataFrame using the projection of the shapefile
proj4string(wind_mills) <- proj4string(polygons)
# get wind mill distribution
windpower_values = over(wind_mills, polygons)
# remove NAs
windpower_distribution = lapply(windpower_values, function(x) x[!is.na(x)])
# create summaries for correlation comparison
# WPC is the attribute containing the wind speed level
a = summary(windpower_values$WPC)
b = summary(polygons@data$WPC)
# ToDo: spatial analysis?