Dear Barry,

The Google Maps API gives me the bounds by calling the getBounds() function.
This gives me the following bounds for example:

((51.888464736976516, 4.457187652587891), (51.92023802576216,
4.543018341064453))

I've used the following R code to generate the KDE surface:

library(Cairo)
library(RColorBrewer)
library(spatstat)
info <- read.csv(file = "input.csv", sep = ";", strip.white = TRUE)
pattern <- ppp(info$lng, info$lat, window = as.owin(c(4.457187652587891,
4.543018341064453, 51.888464736976516, 51.92023802576216)))
Cairo(file="plot.png", type='png', bg='transparent', width=500, height=300)
plot(pattern, main = NULL, box=FALSE)
dev.off()

My Google Map has a height of 500 and a width of 300 pixels. My plot.png is
also 500 by 300 pixels in size. However, the window that includes the points
of my point pattern are much smaller. I'd like the PNG to be exactly 500 by
300 and it should consist of the spatstat window entirely. Right now, even
though plot.png is 500 by 300 pixels, the actual plot is much smaller. Any
ideas on how to achieve this?

For now, I'm looking at a static map. Using javascript I'm able to overlay
the PNG. I need to investigate the possibility of a dynamic overlay which
would involve dealing with tiles. But for now, static maps are enough to
wrap my mind around :)

I've uploaded two examples:

http://skitch.com/mbarbosa/bgqqg/kde-white

http://skitch.com/mbarbosa/bgqq8/kde-transparent

What I wnat to achieve is the following: I want the PNG to be transparent
and it should overlay the entire map. Right now, the plot window is too
small. Thanks a lot for all the replies thus far. Really appreciate it.

Kind regards,

Michel

2009/3/1 Barry Rowlingson <b.rowling...@lancaster.ac.uk>

> 2009/2/28 Michel Barbosa <cica...@gmail.com>:
>
> > I want to overlay my PNG from the bottom left where the Google logo is,
> to
> > the top right above "New Jersey. So the PNG would overlay my entire
> Google
> > Map. This is what I'm trying to achieve. Hope you guys can help me out.
>
>  Isn't there anything in the Google Maps API that gives you the bounds
> of the map region? Use a bit of javascript to put that inside some
> HTML, then cut n paste into R to generate a spatstat window with those
> bounds. Run your kernel density estimation, generate the PNG, then
> overlay on the map.
>
>  Or are you trying to do something dynamic? So that when any user
> moves or zooms their google map, R is somehow called and produces a
> PNG that covers the map view?
>
> Barry
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to