openlayers_layers.module in Openlayers 6
This file holds the main Drupal hook functions and private functions for the openlayers_layers module.
File
modules/openlayers_layers/openlayers_layers.moduleView source
<?php
/**
* @file
* This file holds the main Drupal hook functions
* and private functions for the openlayers_layers module.
*
* @ingroup openlayers
*/
/**
* Implementation of hook_help().
*/
function openlayers_layers_help($path, $arg) {
$output = '';
switch ($path) {
case 'admin/help#openlayers_layers':
$output = '<p>' . t('Provides a wide variety of freely available layers.') . '</p>';
return $output;
}
}
/**
* Implementation of hook_menu().
*/
function openlayers_layers_menu() {
$items = array();
$items['admin/settings/openlayers/layers'] = array(
'title' => 'Layers',
'description' => 'Set your API keys here',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'openlayers_layers_admin_settings',
),
'access arguments' => array(
'administer openlayers',
),
'file' => 'includes/openlayers_layers.admin.inc',
'type' => MENU_LOCAL_TASK,
);
return $items;
}
/**
* Implementation of hook_openlayers_layers_handler().
*/
function openlayers_layers_openlayers_layers_handler_info($map = array()) {
// Define Layer Types that won't be used outside of this module
// such as Google Maps, Yahoo Maps, and MS Virtual Earth
$js_file = drupal_get_path('module', 'openlayers_layers') . '/js/openlayers_layers.layers.js';
return array(
'KML' => array(
'layer_handler' => 'KML',
'js_file' => $js_file,
),
'XYZ' => array(
'layer_handler' => 'XYZ',
'js_file' => $js_file,
),
'Google' => array(
'layer_handler' => 'Google',
'js_file' => $js_file,
),
'VirtualEarth' => array(
'layer_handler' => 'VirtualEarth',
'js_file' => $js_file,
),
'Yahoo' => array(
'layer_handler' => 'Yahoo',
'js_file' => $js_file,
),
'CloudMade' => array(
'layer_handler' => 'CloudMade',
'js_file' => $js_file,
),
);
}
/**
* Implementation of hook_openlayers_layers_info().
*/
function openlayers_layers_openlayers_layers_info() {
$file = drupal_get_path('module', 'openlayers_layers') . '/includes/openlayers_layers.layers.inc';
$callback = 'openlayers_layers_process_layers';
$info = array();
// Define info array
$info['openlayers_layers_nasa_global_mosaic'] = array(
'name' => t('NASA Global Mosaic'),
'description' => t('A high resolution global image mosaic of the earth, produced from 1999-2003 Landsat7 scenes. The highest resolution has a resolution of 15 meters.'),
'projection' => array(
'4326',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_nasa_daily_planet'] = array(
'name' => t('NASA Daily Planet'),
'description' => t('This layer is the most current, near-global image of the earth available. It is a countinuously updating image from the MODIS TERRA satellite'),
'projection' => array(
'4326',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_nasa_blue_marble'] = array(
'name' => t('NASA Blue Marbel'),
'description' => t('Blue Marble Next Generation, A MODIS-derived 500m true color earth dataset showing seasonal dynamics. This version of the BMNG was updated June 2007'),
'projection' => array(
'4326',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_open_aerial'] = array(
'name' => t('Open Aerial'),
'description' => t('OpenAerialMap is an open collection of aerial photographs, collected into a single coherent view of the world.'),
'projection' => array(
'900913',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_google_street'] = array(
'name' => t('Google Street'),
'projection' => array(
'900913',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_google_satellite'] = array(
'name' => t('Google Satellite'),
'projection' => array(
'900913',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_google_hybrid'] = array(
'name' => t('Google Hybrid'),
'projection' => array(
'900913',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_google_physical'] = array(
'name' => t('Google Physical'),
'projection' => array(
'900913',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_yahoo_street'] = array(
'name' => t('Yahoo Street'),
'projection' => array(
'900913',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_yahoo_satellite'] = array(
'name' => t('Yahoo Satellite'),
'projection' => array(
'900913',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_yahoo_hybrid'] = array(
'name' => t('Yahoo Hybrid'),
'projection' => array(
'900913',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_virtual_earth_street'] = array(
'name' => t('Virtual Earth Street'),
'projection' => array(
'900913',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_virtual_earth_satellite'] = array(
'name' => t('Virtual Earth Satellite'),
'projection' => array(
'900913',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_virtual_earth_hybrid'] = array(
'name' => t('Virtual Earth Hybrid'),
'projection' => array(
'900913',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_osm_mapnik'] = array(
'name' => t('OSM Mapnik'),
'projection' => array(
'900913',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_osm_tah'] = array(
'name' => t('OSM Tiles@Home'),
'projection' => array(
'900913',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_osm_cycle'] = array(
'name' => t('OSM Cycling Map'),
'projection' => array(
'900913',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_osm_4326_hybrid'] = array(
'name' => t('OSM Overlay'),
'description' => t('Semi-transparent hybrid overlay. Projectd into WSG84 for use on non spherical-mercator maps.'),
'projection' => array(
'4326',
),
'baselayer' => FALSE,
'file' => $file,
'callback' => $callback,
);
$info['openlayers_layers_cloudmade'] = array(
'name' => t('CloudMade'),
'description' => t('CloudMade tiles. See <a href="http://www.cloudmade.com/">CloudMade</a>.'),
'projection' => array(
'900913',
),
'baselayer' => TRUE,
'file' => $file,
'callback' => $callback,
);
// If KML module is enable, create layer for local KML feed
if (module_exists('kml')) {
$info['openlayers_layers_local_kml'] = array(
'name' => t('Local KML Feed'),
'file' => $file,
'callback' => $callback,
);
}
return $info;
}
/**
* Implementation of hook_domainconf().
*
* See http://therickards.com/api/function/hook_domainconf/Domain
* Adds support for per-domain map keys
*/
function openlayers_layers_domainconf() {
module_load_include('inc', 'openlayers_layers', 'includes/openlayers_layers.admin');
// Get form items and return
return _openlayers_layers_settings_form();
}
Functions
Name | Description |
---|---|
openlayers_layers_domainconf | Implementation of hook_domainconf(). |
openlayers_layers_help | Implementation of hook_help(). |
openlayers_layers_menu | Implementation of hook_menu(). |
openlayers_layers_openlayers_layers_handler_info | Implementation of hook_openlayers_layers_handler(). |
openlayers_layers_openlayers_layers_info | Implementation of hook_openlayers_layers_info(). |