[R-sig-Geo] cannot open: HTTP status was '403 Forbidden' The "sensor" parameter specified in the request must be set to either "true" or "false".

Anisha Kaul born.rebel.83 at gmail.com
Tue Jul 17 06:41:05 CEST 2012


This is solved - credit to Marcelo from stackoverflow.

Attached the '&' to the front of the markers list as follows:

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

This resulted in the url:
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


-Anisha


On 16 July 2012 17:55, Anisha Kaul <born.rebel.83 at gmail.com> wrote:
> The "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',
> sensor = "false", destfile = "MyTile1.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)
> __________________________________________
>
>
>
> Executing this from R results in:
> __________________________________________
>> 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=false40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc"
> Error in download.file(url, destfile, mode = "wb", quiet = TRUE) :
>   cannot open URL
> 'http://maps.google.com/maps/api/staticmap?size=640x640&maptype=terrain&format=png32&sensor=false40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc'
> In addition: Warning message:
> In download.file(url, destfile, mode = "wb", quiet = TRUE) :
>   cannot open: HTTP status was '403 Forbidden'
>>
> __________________________________________
>
>
> I copied its url and pasted it in the browser:
> __________________________________________
> http://maps.google.com/maps/api/staticmap?size=640x640&maptype=terrain&format=png32&sensor=false40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc
> __________________________________________
>
> It resulted in the following message:
> The Google Maps API server rejected your request. The "sensor"
> parameter specified in the request must be set to either "true" or
> "false".
>
>
> When I change the position of "&sensor=false" in the above url, it works fine:
> __________________________________________
> http://maps.google.com/maps/api/staticmap?size=640x640&maptype=terrain&format=png3240.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.998284,redc&sensor=false
> __________________________________________
>
>
> ****How to incorporate this change in the "mow.R" file now?****
> Please help;
>
> --
> Anisha Kaul



-- 
Anisha Kaul



More information about the R-sig-Geo mailing list