I have MODIS images for the EVII index, with a polygon shapefile for specific areas in my area :
The images of NDVI and the polygons have the same projection:
> proj4string(data.shape)  "+proj=utm +zone=21 +south +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0" > > proj4string(r)  "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"
My problem is that I can't overlay my polygon on my NDVI images.
I tried this script but did not work:
library(raster) library(rgdal) library(tiff) r <- raster("D:/Rteledetection/Pivots/MODIS/MOD13Q1.006__250m_16_days_EVI_doy2000209_aid0001.tif") str_name <- "MOD13Q1.006__250m_16_days_EVI_doy2000209_aid0001.tif" imported_raster <- raster(str_name) plot(r) # importer les fichiers shapefil data.shape <- readOGR(dsn = "D:/Rteledetection/Pivots/", layer = "2001") plot(data.shape, border = "red") # vector-raster plot(r) plot(data.shape, col = "red", border = "black", add = TRUE)
I would like to know how I can visualize my polygon above the image?
I have already visualized my image and the polygons above on the image in QGIS and it works but I have to zoom on the polygons to visualize them well, the thing that does not exist can not be on R.
@BrunoConteLeite I tried your suggestion and it works, but i have another question. Do I have to load the new line for projection every time? - another question is that when I tried your script to zoom on the limit of the polygon it gives me results like :
that, even if for the 1st polygon when I zoom it goes beyond the limits:
For my objective I must extract the spectral profiles inside my polygon , but I do not know if I will have to delimit the area where are the polygons or just zoom before extract the spectral profiles?