[R-sig-Geo] Create a georeferenced PDF with shapefile, points of interest and values in R
ASANTOS
alexandresantosbr at yahoo.com.br
Tue Mar 7 17:07:29 CET 2017
Dear Members,
I created a georeferenced PDF using a shapefile and OK no problem, but
I'd like to know if is possible to insert a title inside a output pdf
(in top position "My geo PDF"), points of interest (pts.sampling) and
values too.
In my example:
#Packages
|require(rgdal)require(maptools)|
#Create 2 polygons
|sr
<-SpatialPolygons(list(Polygons(list(Polygon(cbind(c(180114,180553,181127,181477,181294,181007,180409,180162,180114),c(332349,332057,332342,333250,333558,333676,332618,332413,332349)))),'1'),Polygons(list(Polygon(cbind(c(180042,180545,180553,180314,179955,179142,179437,179524,179979,180042),c(332373,332026,331426,330889,330683,331133,331623,332152,332357,332373)))),'2')))|
#Convert in spatial polygon
|srdf=SpatialPolygonsDataFrame(sr,data.frame(row.names=c('1','2'),PIDS=1:2))srdf at data
proj4string(srdf)<-CRS("+proj=utm +zone=21 +south +datum=WGS84 +units=m
+no_defs")|
#Create shapefile
|writeOGR(srdf,getwd(),'ARS','ESRI Shapefile')|
#Read shapefile
|contorno_line<-readShapeLines ("ARS.shp")|
#Plot
|plot(contorno_line,main="My geo PDF")|
#Points of interest and values
|x<-c(180684.2,179786.2,180766.4,180335.5,181392.6,180881.9,181167.9,180544.5,180680.9,180259.6)y<-c(332264.8,331057.3,332190.5,331643.7,333384.4,333444.8,333381.6,332607.9,332625.9,331867.7)Class<-c(5,5,3,1,2,3,5,5,2,2)pts<-cbind(x,y,Class)pts.sampling
=SpatialPoints(pts,proj4string=CRS("+proj=utm +zone=21 +south
+datum=WGS84 +units=m
+no_defs"))points(pts.sampling,col="red")text(pts.sampling,labels=paste(pts.sampling$Class),cex=0.7,pos=3)|
#Create a geoPDF
|writeOGR(contorno_line,dsn ="mygeoPDF",layer ="contorno_geo",driver ="PDF")|
But my problem is, how I can put|main="My geo PDF"|,
points(|pts.sampling, col="red"|)
and|text(pts.sampling,labels=paste(pts.sampling$Class), cex=
0.7,pos=3)|inside the mygeoPDF.pdf created?
--
======================================================================
Alexandre dos Santos
Proteção Florestal
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 99686-6970 (VIVO) (+55) 65 3221-2674 (FIXO)
alexandre.santos at cas.ifmt.edu.br
Lattes:http://lattes.cnpq.br/1360403201088680
OrcID: orcid.org/0000-0001-8232-6722 - ResearcherID: A-5790-2016
Researchgate:www.researchgate.net/profile/Alexandre_Santos10
LinkedIn: br.linkedin.com/in/alexandre-dos-santos-87961635
Mendeley:www.mendeley.com/profiles/alexandre-dos-santos6/
======================================================================
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list