Dear R-sig-Geo List Members,

 

How might I adjust a GE_SG object so that kmlOverlay() will produce a PNG
that extends beyond the outermost points in a SpatialPoints object?  When
the outermost points are used to establish the extent of the grid, the
symbols marking the location of the outermost points are cut off in the
resulting image.  I tried changing the bounding box, the width and height,
the plot limits, and the setParUsrBB argument, but those changes did not
produce the desired outcome.  In most cases, those changes mis-placed the
point locations when the KML file was opened in Google Earth.  I posted a
file that shows the problem (note that the top left, rightmost, and
bottommost symbols are cut off):

http://www.tc.umn.edu/~moor0554/BigTen_TEMP.pdf

 

This code can be used to reproduce the problem:

####################

windows(record=T)

 

coords.alt <- matrix(c(40.10902, -88.22885, 39.16659, -86.5269, 41.65422,
-91.53617, 42.2813, -83.73716, 42.73825, -84.48284, 44.97622, -93.23358,
42.04988, -87.6782, 40.00406, -83.0112, 40.79319, -77.86, 40.42994,
-86.91141, 43.07581, -89.3976), nrow=11, ncol=2, byrow=T)

data.alt <- data.frame(coords.alt)

colnames(data.alt) <- c("lat", "long")

for(i in c(1,2)) {data.alt[,i] <- as.numeric(data.alt[,i])}

data.alt

data <- data.alt

library(maptools)

coordinates(data) <- c("long","lat")

proj4string(data) <- CRS("+proj=longlat")

 

getwd()

SG.big.ten <- GE_SpatialGrid(data)

png("bigten.png", width=SG.big.ten$width, height=SG.big.ten$height,
bg="transparent")

par(mar=c(0,0,0,0), xaxs="i", yaxs="i")

plot(data, xlim=SG.big.ten$xlim, ylim=SG.big.ten$ylim, setParUsrBB=TRUE,
cex=3, pch=21, bg="red")

dev.off()

kmlOverlay(SG.big.ten, "bigten.kml", "bigten.png")

plot(data, xlim=SG.big.ten$xlim, ylim=SG.big.ten$ylim, setParUsrBB=TRUE,
cex=3, pch=21, bg="red")

####################

 

Thank you for your assistance.

 

Regards,

Chris

 

P.S. I'm using R 2.8.0 on Windows XP.

 

--
Christopher Moore, M.P.P.
Doctoral Student
Quantitative Methods in Education
University of Minnesota
 <mailto:moor0554@umn.edu> moor0554@umn.edu
 <http://www.tc.umn.edu/~moor0554/> http://www.tc.umn.edu/~moor0554/



 


	[[alternative HTML version deleted]]

