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

Virgilio Gomez Rubio Virgilio.Gomez at uclm.es
Fri Oct 24 12:06:57 CEST 2008


Marta.

I would say that it is a problem with the coordinates of your data. If
your original data are not in longlat you need to re-project them (with
spTransform) before exporting to GE. 

You can find an example with the meuse data set on these slides prepared
by Roger Bivand:

http://www.bias-project.org.uk/ASDARcourse/unit4_slides.pdf

The original data are not in longlat so they are re-projected before
being exported.

Hope this helps,

Virgilio

El vie, 24-10-2008 a las 10:49 +0100, Marta Rufino escribió:
> 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)
> dev.off()
> kmlOverlay(SGqk, paste(tf, ".kml", sep=""), paste(tf, ".png", sep=""))
> 
> # than the files produced are in
> tf()
> 
> 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,
> Marta
> 
> I am in windows, R 2.7.1, maptools, version 0.7-15, 2008-08-14...
> GDAL 1.5.2, released 2008/05/29
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo




More information about the R-sig-Geo mailing list