Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Static Maps URL length limit

I have 153 markers and need to generate a static map with them, but when put them in the url I get an error like this:

414 Request-Uri Too Large

My url is something like this

"http://maps.google.com/maps/api/staticmap?center=13.00,-85.00&size=600x500&maptype=roadmap&markers=13.305,-86.18636&markers=13.72326,-86.13705&......"

Thanks folks!

like image 724
eos87 Avatar asked Nov 25 '10 14:11

eos87


People also ask

Is Google Static maps free?

The Maps Static API uses a pay-as-you-go pricing model. Requests for the Maps Static API are billed under the SKU for Static Maps. Along with the overall Google Terms of Use, there are usage limits specific to the Maps Static API.

Is the largest image size allowed in Static maps API?

Note however that the largest image pixel size that the Static Maps API can generate for Premier customers, regardless of the value of the scale parameter, is 2048x2048.

What is the Google Maps API limit?

30,000 requests per minute. 300 requests per minute per IP address. In the Google Cloud Console, this quota is referred to as Map loads per minute per user.


3 Answers

The way i see it is either you reduce precision of your markers in order to gain space in the URL. (i.e. markers=13.72326,-86.13705---->markers=13.73,-86.14) resulting in placing the markers in a grid...
Or you go with a non static api

like image 97
Argiropoulos Stavros Avatar answered Sep 28 '22 08:09

Argiropoulos Stavros


This response came from the Server (google). So you're not allowed to request such long URLs.

See the google api doc for more infos:

Static Map URLs are restricted to 2048 characters in size. In practice, you will probably not have need for URLs longer than this, unless you produce complicated maps with a high number of markers and paths.

like image 24
scheffield Avatar answered Sep 28 '22 08:09

scheffield


I had same problem,

i used link like this, and reduced position precision:

http://maps.googleapis.com/maps/api/staticmap?center=61.52401,105.318756&zoom=2&size=710x400&markers=|59,30|48,44|55,37|55,37|55,37|56,44|56,60|55,49|47,39|57,39|55,37|55,82|47,39|55,37|53,50|51,36|55,37|54,73|45,38|48,44|50,43|46,44|51,42|56,53|59,32|59,30|60,30|59,30|59,28|59,32|59,29|58,31|68,33|56,92|59,38|57,56|55,37|55,36|55,38|55,37|55,38|56,38|55,38|51,46|55,38|45,41|53,49|55,61|50,36|50,36|55,48|55,48|55,49|56,50|56,47|53,91|47,39|57,61|44,37|56,86|55,43|44,41|43,13|43,13|42,13|42,13|57,61|64,40|46,48|55,45|52,47|56,43|54,19|53,83|48,40|54,54|53,58|54,83|59,56|52,85|48,13|55,55|50,12|51,40|56,43|49,40|59,33|37,34|58,33|53,34|54,42|56,30|58,54|54,33|56,60|58,60|57,46|43,44|56,40|49,36|49,32|47,42|59,39|56,35|51,39|55,38|57,45|55,42|56,43|56,43|57,13|56,43|56,44|55,42|55,44|55,42|55,43|54,43|54,44|54,43|56,44|55,45|55,43|57,45|56,43|55,44|57,46|56,45|57,53|60,28&sensor=false

like image 44
Edmhs Avatar answered Sep 28 '22 10:09

Edmhs