diff --git a/modules/openlayers_views/openlayers_views.module b/modules/openlayers_views/openlayers_views.module index f9b7cba..bf3a1db 100644 --- a/modules/openlayers_views/openlayers_views.module +++ b/modules/openlayers_views/openlayers_views.module @@ -121,6 +121,12 @@ function openlayers_views_openlayers_layers() { $layer->title = empty($data->display_options['title']) ? $view->name : $data->display_options['title']; $layer->title .= ' - ' . $data->display_title; $layer->description = $view->description; + if (isset($data->display_options['style_options']['data_source']['projection'])) { + $layer->data['projection'] = array($data->display_options['style_options']['data_source']['projection']); + } + else { + $layer->data['projection'] = (isset($data->handler->default_display->display->display_options['style_options']['data_source']['projection'])) ? array($data->handler->default_display->display->display_options['style_options']['data_source']['projection']) : array("EPSG:4326"); + } $layer->data['views'] = array('view' => $view->name, 'display' => $display); $layers[$layer->name] = $layer; } diff --git a/modules/openlayers_views/views/openlayers_views_style_data.inc b/modules/openlayers_views/views/openlayers_views_style_data.inc index f85e1fe..cc0c1e4 100644 --- a/modules/openlayers_views/views/openlayers_views_style_data.inc +++ b/modules/openlayers_views/views/openlayers_views_style_data.inc @@ -134,6 +134,15 @@ class openlayers_views_style_data extends views_plugin_style { '#states' => $this->datasource_dependent('wkt') ); + $form['data_source']['projection'] = array( + '#type' => 'select', + '#title' => t('Projection'), + '#description' => t('Choose the projection of the WKT field.'), + '#options' => $projections, + '#default_value' => (isset($this->options['data_source']['projection'])) ? $this->options['data_source']['projection'] : 'EPSG:4326', + '#states' => $this->datasource_dependent('wkt'), + ); + $form['data_source']['other_top'] = array( '#type' => 'select', '#title' => t('Top Field'), @@ -329,7 +338,7 @@ class openlayers_views_style_data extends views_plugin_style { // Create features array. $feature = array( - 'projection' => 'EPSG:4326', + 'projection' => (isset($this->options['data_source']['projection'])) ? $this->options['data_source']['projection'] : 'EPSG:4326', 'attributes' => $attributes, 'wkt' => $wkt, );