[R-sig-Geo] bad position of png & klm file in google earth

Marta Rufino mrufino at cripsul.ipimar.pt
Fri Oct 24 11:49:43 CEST 2008

Dear list,

I would like to start by acknowledging the wonderful work of this 
support list :-)
I have  a question, which should be prety dummy,... but I was looking 
around in the net, in reports, etc. and could not sort it out.

I am trying to export a image plot to google earth. I manage to do it 
with  points data... ok. but when I do it with the images, they simply 
go to Fiji (which I am sure it is a nice place... but a bit far from the 
Algarve, where it should be).
Even the example given in the help file, the image goes to the same 
place. What am I doing wrong?

require(maptools); require(rgdal)
# This is the example, in the file
opt_exask <- options(example.ask=FALSE)
qk <- SpatialPointsDataFrame(quakes[, c(2:1)], quakes)
proj4string(qk) <- CRS("+proj=longlat")
tf <- tempfile()
SGqk <- GE_SpatialGrid(qk)
png(file=paste(tf, ".png", sep=""), width=SGqk$width, 
height=SGqk$height, bg="transparent")
par(mar=c(0,0,0,0), xaxs="i", yaxs="i")
plot(qk, xlim=SGqk$xlim, ylim=SGqk$ylim, setParUsrBB=TRUE)
kmlOverlay(SGqk, paste(tf, ".kml", sep=""), paste(tf, ".png", sep=""))

# than the files produced are in

I go to the file, pick it the two of them and drag it in google earth... 
and there they are, in Fiji!!! I am sure it is silly, but it is my first 
steps in googleearth--R :-(
If I open it through google earth, it is the same...

A second doubt I have is if we can set apriori, in R the markers 
projected in google earth... how do I do if instead of the pins, I want 
a ball? Do I have to change one by one?

Thank you very much in advance,
Best wishes,

I am in windows, R 2.7.1, maptools, version 0.7-15, 2008-08-14...
GDAL 1.5.2, released 2008/05/29

More information about the R-sig-Geo mailing list