I have got the forest cover data of a region in africa (raster layer) and some data collected inside this region by a survey (.csv). In the .csv file I have got x,y coordinates and 3 other columns with information.

The coordinates are in formated in WGS84 projection as my raster file. Now i need to add 1 point for every coordinate into the raster layer.

I guess my problem is mainly that I have no allocation to a CRS in my .csv data.

How can I solve that or is that not the problem?


If your projection of your points are the same as the raster then you can just pull the proj4string slot from the raster and assign it to the raster. Reading the data, coercing the csv to a SpatialPointsDataFrame and assigning the projection from the raster, would look something like this (not tested):


r <- raster("my.raster")
pts <- read.csv("my.points.csv")

# coerce data.frame to sp points and assign projection from raster
coordinates(pts) <- ~x+y # x and y are the columns in your data.frame holding coordinate
proj4string(pts) <- proj4string(r)
  • Seems to work AND is the same answer as there is in an other post. I only made the misstake that I took x and y and did not look at my data where it was X and Y (in big letters)... so thanks anyway! Apr 26 '16 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.