[R-sig-Geo] plotting spatial data on a map

José Luis Rotundo rotundo.jose at gmail.com
Fri Jun 5 21:00:23 CEST 2015


Dear List,

I am trying to have some spatial data of an atrribute (protein.db) in
a map from Argentina that has county level boundaries.I need to
convert and plot the map and data points in UTM 20 south. What I want
to achieve is a map with the counties and the data plotted.

The following error message is shown at the last sentence of the script:
Error in matrix(0, rows.per.page, cols.per.page) :
  invalid 'nrow' value (too large or NA)

The database is here: http://www.filedropper.com/datosproteina12131314

The script is as follows:

data<-Datos.Proteina.1213.1314

library(gstat)
library(sp)
library(maptools)

coordinates(data) <- c('Longitud' , 'Latitud')
proj_geog <- "+proj=utm +zone=20 +south +datum=WGS84 +units=m +ellps=WGS84"
proj4string(data) <- CRS(proj_geog)
summary(data)

library(raster)
library(rgdal)

## Download data from gadm.org
mapArg <- getData('GADM', country='ARG', level=2)
summary(mapArg)
plot(mapArg)

utm.arg <- "+proj=utm +zone=20 +south +datum=WGS84 +units=m +ellps=WGS84"
data <- spTransform(data, CRS(utm.arg))
mapArg.sp <- spTransform(mapArg, CRS(utm.arg))
plot(mapArg.sp)

l3 <- list("sp.polygons", mapArg.sp,  lwd = 0.3, first = FALSE)
spplot(data, "Protein.db", pch=20, col="grey", sp.layout = l3)


Thanks in advance for any help in solving this issue.

Best,

Jose



-- 

José L. Rotundo
CONICET
Facultad de Ciencias Agrarias
Univ. Nacional de Rosario
Zavalla, Santa Fe
Argentina



More information about the R-sig-Geo mailing list