How can I get a static URL to a map image using the Google Static Maps API?

Posted by Argote on Stack Overflow See other posts from Stack Overflow or by Argote
Published on 2011-01-06T08:50:53Z Indexed on 2011/01/06 8:53 UTC
Read the original article Hit count: 304

Filed under:
|
|
|
|

=== BACKGROUND ===

Hello, so I've published a Web-App (still in "Beta") which uses the Flickr API to get information for the photos of a particular Flickr user and generates IPB code to post any of his/her images.

While Flickr now gives you the IPB code to show the image and link back to the photo site directly on its site, my App also has the option of embeding the title, description, select EXIF data, location information, etc. into the post for the IPB forum.

=== PROBLEM ===

I've most recently added the option to integrate a Google Maps image of the photo's geolocation data into the post by using the Google Static Maps API.

The problem is that the image URL I have is in the following form (including IPB [IMG] tags):

[IMG]http://maps.google.com/maps/api/staticmap?zoom=16&size=600x600&maptype=hybrid&markers=19.387687,-99.251732&sensor=false[/IMG]

Which shows this example image (In practice the image size is user selectable):

alt text

However, some IPB forums seem to not support dyamic image URLs which gives me a broken image, I'd like to replace the

[IMG]http://maps.google.com/maps/api/staticmap?zoom=16&size=600x600&maptype=hybrid&markers=19.387687,-99.251732&sensor=false[/IMG]

with something like

[IMG]http://maps.google.com/maps/api/staticmap/map0000001.png[/IMG]

which should be supported by all IPB forums. Thanks in advance for your help.

In case you're interested, the most recent "released" version of my Web-App can be found here: http://flickr.argote.mx/ (The changes I mention here are still on local development server).

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about image