I think that this might belong here. This extends the latitude and longitude text fields as part of the Geocoder module.

For most of the geocoding uses it, the geocoder, will return only one point per content type it is being attached to such as a magazine article, a business location, ect. There really isn't much need to download the entire openlayers.js script on each page load if the location can be displayed on a static map. I wrote a PHP function that was added to template.php using the complete extent of my coding abilities that makes a call to Google Static Maps API using the latitude and longitude text fields. Also, I hid the OpenLayers map from display. Here is my function. Within page.tpl.php the function tests for the content type and passes a width and height to the function.

function triton_static_map(&$vars, $width, $height) {
  $map = '';
  $map = "<img src='http://maps.google.com/maps/api/staticmap?";
  $map .= "center=" . $vars->field_location_latitude[0][value] . "," . $vars->field_location_longitude[0][value];
  $map .= "&zoom=13&size=" . $width . "x" . $height;
  $map .= "&markers=color:blue|label:A|" . $vars->field_location_latitude[0][value] . "," . $vars->field_location_longitude[0][value];
  $map .= "&sensor=false";
  $map .= "' />";
  return $map;
}

I think that it would be cool if the Geocoder offered this ability and an admin configuration page that sets the parameters per content type that uses the Geocoder.

Comments

steinmb’s picture

Title: Using Static Maps » Support Google static maps
Project: OpenLayers Geocoder » Openlayers

Geocoder does very little when it comes to presentation. Moving to OL.

ken-g’s picture

Status: Active » Closed (outdated)