diff --git a/gmap.views.inc b/gmap.views.inc
index ee23b9f..4ad9f43 100644
--- a/gmap.views.inc
+++ b/gmap.views.inc
@@ -15,6 +15,13 @@ function theme_gmap_views_view_gmapextended(&$vars) {
   }
   // @@@ Move to preprocess
   $map = gmap_parse_macro($vars['options']['macro']);
+
+  // If center lon/lat are not empty they are used to center map
+  if (!empty($vars['center']['longitude']) && !empty($vars['center']['latitude'])) {
+    $map['longitude'] = $vars['center']['longitude'];
+    $map['latitude'] = $vars['center']['latitude'];
+  }
+
   if (!empty($vars['options']['iwq'])) {
     $map['iwq'] = $vars['options']['iwq'];
   }
@@ -42,6 +49,13 @@ function template_preprocess_gmap_views_view_gmapextended(&$vars) {
 
   $fields   = &$view->field;
 
+  if ($view->style_plugin->options['center_on_proximityfilter'] && $view->style_plugin->options['datasource'] == 'location' && module_exists('location')) {
+    $vars['center'] = location_views_proximity_get_reference_location($view, array(
+			'origin' => 'tied',
+      'relationship' => $view->style_plugin->options['center_on_proximityfilter_rel'])
+    );
+  }
+
   // Render fields.
   $renders = $handler->render_fields($result);
 
diff --git a/gmap_plugin_style_gmapextended.inc b/gmap_plugin_style_gmapextended.inc
index ea11e1e..d8dd031 100644
--- a/gmap_plugin_style_gmapextended.inc
+++ b/gmap_plugin_style_gmapextended.inc
@@ -16,7 +16,7 @@ class gmap_plugin_style_gmapextended extends views_plugin_style {
    */
   function option_definition() {
     $options = parent::option_definition();
-    
+
     $options['fallback_values'] = array('default' => array());
     $options['field_purposes'] = array('default' => array());
 
@@ -44,6 +44,8 @@ class gmap_plugin_style_gmapextended extends views_plugin_style {
     $options['highlight_nodearg_arg'] = array('default' => '');
     $options['highlight_nodearg_color'] = array('default' => '#FF0000');
     */
+    $options['center_on_proximityfilter'] = array('default' => 0);
+    $options['center_on_proximityfilter_rel'] = array('default' => '');
 
     return $options;
   }
@@ -157,7 +159,7 @@ class gmap_plugin_style_gmapextended extends views_plugin_style {
       ),
       '#default_value' => isset($this->options['clickmode']) ? $this->options['clickmode'] : 'render',
     );
-    
+
     $form['rmtcallback'] = array(
       '#type' => 'textfield',
       '#title' => t('RMT callback path'),
@@ -166,7 +168,7 @@ class gmap_plugin_style_gmapextended extends views_plugin_style {
       '#process' => array('ctools_dependent_process'),
       '#dependency' => array('radio:style_options[clickmode]' => array('rmt')),
     );
-    
+
     $form['iwq'] = array(
       '#type' => 'textfield',
       '#title' => t('Info window query (default)'),
@@ -328,6 +330,54 @@ class gmap_plugin_style_gmapextended extends views_plugin_style {
       '#dependency' => array('edit-style-options-highlight-nodearg' => array(TRUE)),
     );
 */
+
+    if (module_exists('location')) {
+      $form['center_on_proximityfilter'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Center on proximity filter'),
+        '#default_value' => $this->options['center_on_proximityfilter'],
+        '#description' => t('Note: The view must contain a "Location: Distance / Proximity" filter'),
+      );
+
+      // A whole bunch of code to figure out what relationships are valid for
+      // this item.
+      $relationships = $this->display->handler->get_option('relationships');
+      $relationship_options = array();
+
+      foreach ($relationships as $relationship) {
+        $relationship_handler = views_get_handler($relationship['table'], $relationship['field'], 'relationship');
+
+        // If this relationship is valid for this type, add it to the list.
+        $data = views_fetch_data($relationship['table']);
+        $base = $data[$relationship['field']]['relationship']['base'];
+        if ($base == 'location') {
+          $relationship_handler->init($view, $relationship);
+          $relationship_options[$relationship['id']] = $relationship_handler->label();
+        }
+      }
+
+      if (!empty($relationship_options)) {
+        $relationship_options = array_merge(array('none' => t('Do not use a relationship')), $relationship_options);
+        $rel = empty($this->options['relationship']) ? 'none' : $this->options['relationship'];
+        if (empty($relationship_options[$rel])) {
+          // Pick the first relationship.
+          $rel = key($relationship_options);
+        }
+
+        $form['center_on_proximityfilter_rel'] = array(
+          '#type' => 'select',
+          '#title' => t('Relationship'),
+          '#options' => $relationship_options,
+          '#default_value' => $rel,
+        );
+      }
+      else {
+        $form['center_on_proximityfilter_rel'] = array(
+          '#type' => 'value',
+          '#value' => 'none',
+        );
+      }
+    }
   }
 
   /**
