Revision 2b83cc8b
Added by Andreas Kohlbecker over 7 years ago
modules/cdm_dataportal/includes/maps.inc | ||
---|---|---|
137 | 137 |
|
138 | 138 |
$layer_names = $map_settings['openlayers']['base_layers']; |
139 | 139 |
|
140 |
foreach($layer_names as $name){ |
|
141 |
if(str_beginsWith($name, 'g')){ |
|
142 |
if( isset($map_settings['openlayers']['google_maps_api_key']) && strlen($map_settings['openlayers']['google_maps_api_key']) == 39) { |
|
143 |
// google layer detected |
|
144 |
drupal_add_js("https://maps.googleapis.com/maps/api/js?key=" . $map_settings['openlayers']['google_maps_api_key'] . "&callback=initMap", 'external'); |
|
145 |
} else { |
|
146 |
drupal_set_message('A Google Maps layer is configured but the API key is either missing or invalid. |
|
147 |
Please set your Google Maps API key in the ' . l('Geo & Map Settings', 'admin/config/cdm_dataportal/settings/geo') .'.', 'warning'); |
|
148 |
} |
|
149 |
|
|
150 |
} |
|
151 |
} |
|
152 |
|
|
140 | 153 |
$cdm_openlayers_options['baseLayerNames'] = array_values($layer_names); |
141 | 154 |
|
142 | 155 |
if($layer_names['PREFERRED']){ |
modules/cdm_dataportal/js/map/openlayers_layers.js | ||
---|---|---|
149 | 149 |
transitionEffect: "resize" |
150 | 150 |
} |
151 | 151 |
); |
152 |
/* |
|
153 |
ALl GOOGLE LAYERS DISABELED until the new map api is integrated |
|
152 |
|
|
154 | 153 |
// create Google Mercator layers |
155 |
case 'gmap': |
|
154 |
case 'gmroadmap':
|
|
156 | 155 |
return new OpenLayers.Layer.Google( |
157 |
"Google Streets",
|
|
156 |
"Google Roadmap",
|
|
158 | 157 |
{ |
159 |
// the default type
|
|
158 |
type: 'roadmap',
|
|
160 | 159 |
projection: window.CdmOpenLayers.projections.epsg_900913, |
161 | 160 |
// Allow user to pan forever east/west |
162 | 161 |
// Setting this to false only restricts panning if sphericalMercator is true. |
163 | 162 |
wrapDateLine: false, |
164 | 163 |
sphericalMercator: true, |
165 |
numZoomLevels: 21,
|
|
164 |
numZoomLevels: 21 |
|
166 | 165 |
} |
167 | 166 |
); |
168 | 167 |
|
169 |
case 'gsat': |
|
168 |
case 'gsatellite':
|
|
170 | 169 |
// FIMXE: layer distorted, use OpenLayers.Layer.Google.v3? |
171 | 170 |
return new OpenLayers.Layer.Google( |
172 | 171 |
"Google Satellite", |
173 | 172 |
{ |
174 |
type: G_SATELLITE_MAP,
|
|
173 |
type: 'satellite',
|
|
175 | 174 |
projection: window.CdmOpenLayers.projections.epsg_900913, |
176 | 175 |
// Allow user to pan forever east/west |
177 | 176 |
// Setting this to false only restricts panning if sphericalMercator is true. |
... | ... | |
179 | 178 |
numZoomLevels: 22 |
180 | 179 |
} |
181 | 180 |
); |
182 |
case 'ghyb': |
|
183 |
// FIMXE: layer not working, use OpenLayers.Layer.Google.v3? |
|
181 |
case 'ghybrid': |
|
184 | 182 |
return new OpenLayers.Layer.Google( |
185 | 183 |
"Google Hybrid", |
186 | 184 |
{ |
187 |
type: G_HYBRID_MAP,
|
|
185 |
type: 'hybrid',
|
|
188 | 186 |
projection: window.CdmOpenLayers.projections.epsg_900913, |
189 | 187 |
// Allow user to pan forever east/west |
190 | 188 |
// Setting this to false only restricts panning if sphericalMercator is true. |
... | ... | |
192 | 190 |
numZoomLevels: 22 |
193 | 191 |
} |
194 | 192 |
); |
195 |
*/ |
|
193 |
|
|
194 |
case 'gterrain': |
|
195 |
return new OpenLayers.Layer.Google( |
|
196 |
"Google Terrain", |
|
197 |
{ |
|
198 |
type: 'terrain', |
|
199 |
projection: window.CdmOpenLayers.projections.epsg_900913, |
|
200 |
// Allow user to pan forever east/west |
|
201 |
// Setting this to false only restricts panning if sphericalMercator is true. |
|
202 |
wrapDateLine: false, |
|
203 |
numZoomLevels: 22 |
|
204 |
} |
|
205 |
); |
|
206 |
|
|
196 | 207 |
/* |
197 | 208 |
* FIXME: apiKey needs to be specified |
198 | 209 |
case 'veroad': |
modules/cdm_dataportal/settings.php | ||
---|---|---|
480 | 480 |
'units' => NULL |
481 | 481 |
), |
482 | 482 |
'show_layer_switcher' => TRUE, |
483 |
'display_outside_max_extent' => FALSE |
|
483 |
'display_outside_max_extent' => FALSE, |
|
484 |
'google_maps_api_key' => NULL, |
|
484 | 485 |
), |
485 | 486 |
'legend' => array( |
486 | 487 |
'show' => TRUE, |
... | ... | |
2855 | 2856 |
'mapquest_open' => "MapQuest", |
2856 | 2857 |
'mapquest_sat' => "MapQuest Sattelite", |
2857 | 2858 |
// 'osmarender' => 'OpenStreetMap (Tiles@home)', |
2858 |
// 'gmap' => 'Google Streets', |
|
2859 |
// 'gsat' => 'Google Satellite', |
|
2860 |
// 'ghyb' => 'Google Hybrid', |
|
2859 |
'groadmap' => 'Google Roadmap', |
|
2860 |
'gsatellite' => 'Google Satellite', |
|
2861 |
'ghybrid' => 'Google Hybrid', // TODO: is not working |
|
2862 |
'gterrain' => 'Google Terrain', |
|
2861 | 2863 |
// 'veroad' => 'Virtual Earth Roads', |
2862 | 2864 |
// 'veaer' => 'Virtual Earth Aerial', |
2863 | 2865 |
// 'vehyb' => 'Virtual Earth Hybrid', |
... | ... | |
2875 | 2877 |
'#description' => 'Choose the baselayer layer you prefer to use as map background in the OpenLayers dynamic mapviewer.', |
2876 | 2878 |
); |
2877 | 2879 |
|
2880 |
$google_maps_api_key = null; |
|
2881 |
if(isset($map_distribution['openlayers']['google_maps_api_key'])){ |
|
2882 |
$google_maps_api_key = $map_distribution['openlayers']['google_maps_api_key']; |
|
2883 |
} |
|
2884 |
$form[CDM_MAP_DISTRIBUTION]['openlayers']['google_maps_api_key'] = array( |
|
2885 |
'#type' => 'textfield', |
|
2886 |
'#title' => 'Google Maps API Key', |
|
2887 |
'#default_value' => $google_maps_api_key, |
|
2888 |
'#description' => 'In order to use any of the Google map layers you need to provide |
|
2889 |
your <a href="https://developers.google.com/maps/documentation/javascript/get-api-key">Google Maps API Key</a>. ', |
|
2890 |
); |
|
2891 |
|
|
2878 | 2892 |
$form[CDM_MAP_DISTRIBUTION]['openlayers']['custom_wms_base_layer'] = array( |
2879 | 2893 |
'#type' => 'fieldset', |
2880 | 2894 |
'#title' => 'Custom WMS base layer', |
Also available in: Unified diff
fix #3226 fixing broken Google map layers