Deviling Master
Deviling Master

Reputation: 3113

Max url length with Google Maps static image

I need to create a static image of google map with several markers, and each marker has a custom icon.

In the Api DOC there is the note: 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.

The url is very long.... There is the position for each marker and the URL for the custom icon for each one. I've already tried with POST request ma it is not supported.

There is another way to create a static map image without max length limitation?

A possible way might be this, but i don't know if is it possible: I've create my custom map using the function in GMaps, and i have added all the markers i need. There is a way to access in static way to this particular map? so in the url i have to give only the center of the map and other parameters (zoom, ...), but all the markers are already positioned.

Or... another idea... Can i submit the URL of a KML with all markers positioned instead each single marker position+icon url?

Upvotes: 6

Views: 4964

Answers (5)

Ville N.
Ville N.

Reputation: 714

FYI, Google recently updated the limit to 8192.

Upvotes: 3

swill
swill

Reputation: 2077

Yes, you can definitely do this with the Javascript API.

I have built a few applications using that API. It can be a little tricky to get your head around, but it is pretty good. For what you want to do, it would not be too difficult. If the user has to be able to interact with the map and add pins and such, it starts to get a little more complicated because you have to capture clicks and such.

Does the map its self need to be available as a URL, or does it just need to be embedded on some page and that URL can be used?

The Javascript API will work best if you can embed the map into an existing webpage.

Upvotes: 0

semagor
semagor

Reputation: 11

Another idea

  1. find map area that contains all the markers
  2. divide the map area into rectangular pieces (4 pieces for example)
  3. create image url for each part, but include in url only markers and icons visible on map
  4. show images

Мethod of division depends on the markers position.

Upvotes: 0

bamnet
bamnet

Reputation: 2554

Have you tried using a URL shortener for the icon urls? I believe the static map API will respect services that make URLs shorter... might save you a few characters.

Upvotes: 2

blomman9
blomman9

Reputation: 1624

You might wanna check out toopola´s API to help working with Google Static Maps, I am about to make my own attempt.

Upvotes: 0

Related Questions