Hello, I want to create a kind of heat map for Europe using R. Therefore, I am using a txt - file with the columns X, Y and Temperature. This file contains about 100 point measurement across Europe. Based on a shape file, I want to create a heat map out of these data. This is my code:
geodata <- read.delim("D:/[...]/GeoRef.txt", sep="\t", header = TRUE,row.names = 1, skip = 1) #reading the textfile [1] coordinates(geodata) <- ~X+Y # to convert to SpatialPointsDataFrame #[2] proj4string(geodata)<-CRS("+proj=moll") #[3] geodata.grid <- spsample(geodata,1000, type = "regular", cellsize = c(10,10)) # to create the grid [4] gridded(geodata.grid) <- TRUE #[5] image(geodata.grid,"Temperature", xlim=c(bbox(shape)[1,1], bbox(shape)[1,2]), ylim = c(bbox(shape)[2,1], bbox(shape)[2,2]), col=rainbow(50, start=3/6, end=0)) #[6] shape <- readShapePoly("D:/[...]/world.shp", IDvar=NULL, proj4string=CRS("+proj=moll")) #reading the shape file [7] plot(shape, add=TRUE) #applying shape file on the measured grid [8] The geodata.grid variable is inspirate by the example following 'meuse.grid'. But I think this is also the problem as my variable geodata.grip varies slightly from the format of the meuse.grid. I was following a suggestion posted here: https://stat.ethz.ch/pipermail/r-sig-geo/2009-September/006553.html Can you please tell me how I can create this properly? And, in general, is this a recommended way to create such a map? Thank you very much. Sincerely Sebastian [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo