[R-sig-Geo] Problem in represents shapefile in Landsat image
ASANTOS
alexandresantosbr at yahoo.com.br
Wed Jan 15 17:33:29 CET 2014
Dear Members,
I would like to represents my contour area (contorno_line object)
(53,22ha) in shapefile format in a Landsat 5 images (r1a, r2a and r3a),
but I don't know why my area drops in a river, I verify the proj4string
and both are "+proj=utm +zone=23 +south +datum=WGS84 +units=m +no_defs"
and it's OK and the shapefile was create with the use of geodetic GPS. I
suspect that some kind of transformation is necessary in Landsat image
before the use or any projection problem, Any member can helps me.
Follow my scrip:
require(raster)
require(sp)
require(maptools)
#STARTS
##------------------------------------------------------------------------------
## Bands 5, 4 e 3 of Landsat 5
#
#Download
links <- c(
"https://www.dropbox.com/s/6oie1ns3w52ur96/band5.crop.tif",
"https://www.dropbox.com/s/aa333he7g7vxcsj/band4.crop.tif",
"https://www.dropbox.com/s/3d7ad89uddx57o8/band3.crop.tif")
tokens <- gsub("^.*/s/","",dirname(links))
fileNames <- basename(links)
newLinks <- file.path("http://dl.dropbox.com/s", tokens, fileNames);
newLinks
for (a in newLinks) {
tryCatch(download.file(a, dest=basename(a), mode='wb'),
error=function(...) print("Falha no
download!"))}
#Graphic representation of satellite images
r1a<- raster(c("band5.crop.tif"))
r2a<- raster(c("band4.crop.tif"))
r3a<- raster(c("band3.crop.tif"))
landa<- stack(r1a,r2a,r3a)
plotRGB(landa)
#
#-------------------------------------------------------------------------------
#Download of the contour in shapefile
links <- c(
"https://www.dropbox.com/s/1oz5lhnk96jih3w/Tamandua288.dbf",
"https://www.dropbox.com/s/6b3uygyrjhq1bby/Tamandua288.shp",
"https://www.dropbox.com/s/wntluhn8bi7us2f/Tamandua288.shx")
tokens <- gsub("^.*/s/","",dirname(links))
fileNames <- basename(links)
newLinks <- file.path("http://dl.dropbox.com/s", tokens, fileNames);
newLinks
for (a in newLinks) {
tryCatch(download.file(a, dest=basename(a), mode='wb'),
error=function(...) print("Falha no
download!"))}
contorno_line <- readShapeLines ("Tamandua288.shp",
proj4string=CRS("+proj=utm +zone=23 +south +datum=WGS84 +units=m +no_defs"))
lines(contorno_line,col="red") # And the area drops inside a river.
#
#END
Thanks,
--
======================================================================
Alexandre dos Santos
Proteção Florestal - Forest Protection
IFMT - Instituto Federal de Educação, Ciência e Tecnologia de Mato Grosso
Campus Cáceres
Caixa Postal 244
Avenida dos Ramires, s/n
Bairro: Distrito Industrial
Cáceres - MT CEP: 78.200-000
Fone: (+55) 65 8132-8112 (TIM) (+55) 65 9686-6970 (VIVO)
alexandre.santos at cas.ifmt.edu.br
Lattes: http://lattes.cnpq.br/1360403201088680
More information about the R-sig-Geo
mailing list