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

José Luis Rotundo rotundo.jose at gmail.com
Sat Jun 6 00:47:47 CEST 2015


Thanks Vijay, it worked perfect now!

Best,

Jose


2015-06-05 16:58 GMT-03:00 Vijay Lulla <vijaylulla at gmail.com>:
> There's a mistake in proj_geog line.  Shouldn't it be
>
> proj_geog <- "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84"
> ?
>
> On Fri, Jun 5, 2015 at 3:00 PM, José Luis Rotundo
> <rotundo.jose at gmail.com> wrote:
>> 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
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



-- 

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