I am using lat/long information from a CiviCRM table (thus this data is not associated with any nodes). I would like to be able to center on the first row of data returned by Views.

Is this possible?

Comments

hozt’s picture

Issue summary: View changes

This is an old issue, but I needed the same feature and was able to accomplish this by using a custom module with hook_views_post_execute and modifying the macro to set the values I needed based on the results of query.

function MYMODULE_views_post_execute(&$view) {
  if ((isset($view->result[0]->Longitude)) && ((isset($view->result[0]->Latitude)))) {
    $macro_string = "[gmap zoom=15 | center=" . $view->result[0]->Latitude . "," . $view->result[0]->Longitude . "]";
    $view->style_plugin->options['macro'] = $macro_string;
  }
}