[EHPweb] Gmaps Widget Update

Eric C Matthys ematthys at usgs.gov
Thu Dec 11 20:02:36 GMT 2008


The gmaps (Google Maps) widget has been updated to allow for static 
Google Maps to be created as well as the normal, dynamic Google Maps.  
Static Google Maps are plain images that do not rely upon JavaScript, 
but still allow for many of the non-interactive elements of dynamic 
Google Maps.  Markers and paths can both be created and customized and 
the available map types now include 'terrain' and 'mobile' as well as 
'roadmap', 'satellite', and 'hybrid'.

The getStaticMap() PHP function returns a XHTML image tag that can be 
printed out on the page (maybe between a pair of <noscript> tags if 
being used behind a dynamic Google Map).  Other functions, such as 
getMarker(), allow for the creation of markers without having to know 
the specific format required by the Google Static Maps API.  The source 
of the returned image points to /template/widgets/gmaps/static.gif.php, 
which grabs the API key and creates a connection to Google Maps, serving 
the appropriate static map image.  Therefore, it doesn't matter if the 
user goes through earthquake.usgs.gov, earthquakes.usgs.gov, or 
www.earthquake.usgs.gov, which would otherwise affect which API key to use.

The updated gmaps widget is only available on ehpdevel for now, but if 
you want more information on the functions available for static Google 
Maps, you can see the documentation on the wiki. 
https://ehptools.cr.usgs.gov/trac/wiki/widgets


More information about the EHPweb mailing list