[R-sig-Geo] Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection

Anisha Kaul born.rebel.83 at gmail.com
Tue Jul 17 08:22:30 CEST 2012


This is solved. Here's the working code.

____________________________________
library(RgoogleMaps);
png(filename="Rg.png", width=480, height=480);


lat    = c(40.702147,40.718217,40.711614);
lon    = c(-74.012318,-74.015794,-73.998284);
center = c(mean(lat), mean(lon));
zoom <- min(MaxZoom(range(lat), range(lon)));

MyMap <- GetMap(center=center, zoom=zoom,
markers='&40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc',
destfile="My.png");

tmp <- PlotOnStaticMap(MyMap,lat=c(40.702147,40.711614,40.718217),lon=c(-74.015794,-74.012318,-73.998284),cex=1.5,pch=20,col=c('red',
'blue', 'green'),add=F);

dev.off();
____________________________________



On 17 July 2012 10:54, Anisha Kaul <born.rebel.83 at gmail.com> wrote:
> Greetings,
>
> R version 2.15.1
> RgoogleMaps version 1.2.0
> openSUSE 11.3, 64 bit
>
>
> The source code file 'mow.R' now contains:
> _______________________________________
> library(RgoogleMaps);
> png(filename="RgoogleMaps-package_%03d_med.png", width=480, height=480);
>
> MyMap <- GetMap(markers='&40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc',
> destfile="MyTile1.png");
> _______________________________________
>
>
>
> This results in the following new error:
> _______________________________________
>> source('mow.R')
> [1] "Note that when center and zoom are not specified, no meta
> information on the map tile can be stored. This basically means that R
> cannot compute proper coordinates. You can still download the map tile
> and view it in R but overlays are not possible. Do you want to proceed
> ? (y/n)"
> y
> [1] "&40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc"
> [1] "http://maps.google.com/maps/api/staticmap?size=640x640&maptype=terrain&format=png32&sensor=true&40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc"
>
> Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
> In addition: Warning message:
> In readChar(con, 5L, useBytes = TRUE) :
>   cannot open compressed file 'MyTile1.png.rda', probable reason 'No
> such file or directory'
>>
> _______________________________________
>
>
> I have to say that I don't know what does this function do:
> `png(filename="RgoogleMaps-package_%03d_med.png", width=480,
> height=480);`
> I tried this example from here:
> http://rgm2.lab.nig.ac.jp/RGM2/func.php?rd_id=RgoogleMaps:RgoogleMaps-package
>
> If there is some other information that you want me to include, please
> let me know.
> What's the way to correct this error?
>
>
>
> --
> Regards,
> Anisha Kaul



-- 
Anisha Kaul



More information about the R-sig-Geo mailing list