123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474 |
- <?php
- /**
- * @file
- *
- * OpenLayers default packaged layers
- */
- function _openlayers_openlayers_layers() {
- global $is_https;
- $mapquest_host = $is_https ? '-s.mqcdn.com' : '.mqcdn.com';
- $layers = array();
- $layer = new stdClass();
- $layer->api_version = 1;
- $layer->name = 'google_satellite';
- $layer->title = 'Google Maps Satellite';
- $layer->description = 'Google Maps Satellite Imagery.';
- $layer->data = array(
- 'isBaseLayer' => TRUE,
- 'type' => 'satellite',
- 'projection' => array('900913'),
- 'layer_type' => 'openlayers_layer_type_google',
- );
- $layers[$layer->name] = $layer;
- $layer = new stdClass();
- $layer->api_version = 1;
- $layer->name = 'google_hybrid';
- $layer->title = 'Google Maps Hybrid';
- $layer->description = 'Google Maps with roads and terrain.';
- $layer->data = array(
- 'isBaseLayer' => TRUE,
- 'type' => 'hybrid',
- 'projection' => array('900913'),
- 'layer_type' => 'openlayers_layer_type_google',
- );
- $layers[$layer->name] = $layer;
- $layer = new stdClass();
- $layer->api_version = 1;
- $layer->name = 'google_normal';
- $layer->title = 'Google Maps Normal';
- $layer->description = 'Standard Google Maps Roads';
- $layer->data = array(
- 'isBaseLayer' => TRUE,
- 'type' => 'normal',
- 'projection' => array('900913'),
- 'layer_type' => 'openlayers_layer_type_google',
- );
- $layers[$layer->name] = $layer;
- $layer = new stdClass();
- $layer->api_version = 1;
- $layer->name = 'google_physical';
- $layer->title = 'Google Maps Physical';
- $layer->description = 'Google Maps Hillshades';
- $layer->data = array(
- 'isBaseLayer' => TRUE,
- 'type' => 'physical',
- 'projection' => array('900913'),
- 'layer_type' => 'openlayers_layer_type_google',
- );
- $layers[$layer->name] = $layer;
- $layer = new stdClass();
- $layer->api_version = 1;
- $layer->name = 'mapquest_osm';
- $layer->title = 'MapQuest OSM';
- $layer->description = 'MapQuest’s rendering of OpenStreetMap.';
- $layer->data = array(
- 'isBaseLayer' => TRUE,
- 'attribution' => t('©<a href="@ccbysa">CCBYSA</a> '.
- '<a href="@openstreetmap">© OpenStreetMap contributors</a>',
- array(
- '@openstreetmap' => 'http://www.openstreetmap.org/copyright',
- '@ccbysa' => 'http://creativecommons.org/licenses/by-sa/2.0/',
- )
- ) . '. '. t('Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a>.'),
- 'projection' => array('900913'),
- 'layer_type' => 'openlayers_layer_type_xyz',
- 'url' => array(
- '//otile1' . $mapquest_host . '/tiles/1.0.0/osm/${z}/${x}/${y}.png',
- '//otile2' . $mapquest_host . '/tiles/1.0.0/osm/${z}/${x}/${y}.png',
- '//otile3' . $mapquest_host . '/tiles/1.0.0/osm/${z}/${x}/${y}.png',
- '//otile4' . $mapquest_host . '/tiles/1.0.0/osm/${z}/${x}/${y}.png',
- ),
- 'wrapDateLine' => FALSE,
- 'resolutions' => openlayers_get_resolutions('900913', 0, 19)
- );
- $layers[$layer->name] = $layer;
- $layer = new stdClass();
- $layer->api_version = 1;
- $layer->name = 'mapquest_openaerial';
- $layer->title = 'MapQuest Open Aerial';
- $layer->description = 'MapQuest’s aerial photo map.';
- $layer->data = array(
- 'isBaseLayer' => TRUE,
- 'attribution' => t('Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency.')
- . ' '. t('Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a>.'),
- 'projection' => array('900913'),
- 'layer_type' => 'openlayers_layer_type_xyz',
- 'url' => array(
- '//oatile1' . $mapquest_host . '/naip/${z}/${x}/${y}.png',
- '//oatile2' . $mapquest_host . '/naip/${z}/${x}/${y}.png',
- '//oatile3' . $mapquest_host . '/naip/${z}/${x}/${y}.png',
- '//oatile4' . $mapquest_host . '/naip/${z}/${x}/${y}.png',
- ),
- 'wrapDateLine' => TRUE,
- );
- $layers[$layer->name] = $layer;
- $layer = new stdClass();
- $layer->api_version = 1;
- $layer->name = 'yahoo_satellite';
- $layer->title = 'Yahoo Maps Satellite';
- $layer->description = 'Yahoo satellite imagery tiles.';
- $layer->data = array(
- 'isBaseLayer' => TRUE,
- 'type' => 'satellite',
- 'projection' => array('900913'),
- 'layer_type' => 'openlayers_layer_type_yahoo',
- );
- $layers[$layer->name] = $layer;
- $layer = new stdClass();
- $layer->api_version = 1;
- $layer->name = 'yahoo_street';
- $layer->title = 'Yahoo Maps Street';
- $layer->description = 'Yahoo streets tiles.';
- $layer->data = array(
- 'isBaseLayer' => TRUE,
- 'type' => 'street',
- 'projection' => array('900913'),
- 'layer_type' => 'openlayers_layer_type_yahoo',
- );
- $layers[$layer->name] = $layer;
- $layer = new stdClass();
- $layer->api_version = 1;
- $layer->name = 'yahoo_hybrid';
- $layer->title = 'Yahoo Maps Hybrid';
- $layer->description = 'Yahoo hybrid of streets and satellite tiles.';
- $layer->data = array(
- 'isBaseLayer' => TRUE,
- 'type' => 'hybrid',
- 'projection' => array('900913'),
- 'layer_type' => 'openlayers_layer_type_yahoo',
- );
- $layers[$layer->name] = $layer;
- // Bing Road
- $layer = new stdClass();
- $layer->api_version = 1;
- $layer->name = 'bing_road';
- $layer->title = 'Bing Road';
- $layer->description = 'Bing Road tiles.';
- $layer->data = array(
- 'isBaseLayer' => TRUE,
- 'type' => 'Road',
- 'projection' => array('900913'),
- 'layer_type' => 'openlayers_layer_type_bing',
- );
- $layers[$layer->name] = $layer;
- // Bing Aerial
- $layer = new stdClass();
- $layer->api_version = 1;
- $layer->name = 'bing_aerial';
- $layer->title = 'Bing Aerial';
- $layer->description = 'Bing Aerial tiles.';
- $layer->data = array(
- 'isBaseLayer' => TRUE,
- 'type' => 'Aerial',
- 'projection' => array('900913'),
- 'layer_type' => 'openlayers_layer_type_bing',
- );
- $layers[$layer->name] = $layer;
- // Bing Hybrid
- $layer = new stdClass();
- $layer->api_version = 1;
- $layer->name = 'bing_hybrid';
- $layer->title = 'Bing Hybrid';
- $layer->description = 'Bing Hybrid tiles.';
- $layer->data = array(
- 'isBaseLayer' => TRUE,
- 'type' => 'AerialWithLabels',
- 'projection' => array('900913'),
- 'layer_type' => 'openlayers_layer_type_bing',
- );
- $layers[$layer->name] = $layer;
- // OpenStreetMap Mapnik
- $layer = new stdClass();
- $layer->api_version = 1;
- $layer->name = 'osm_mapnik';
- $layer->title = 'OSM Mapnik';
- $layer->description = 'The main OpenStreetMap map';
- $layer->data = array(
- 'isBaseLayer' => TRUE,
- 'attribution' => t('©<a href="@ccbysa">CCBYSA</a> '.
- '<a href="@openstreetmap">© OpenStreetMap contributors</a>',
- array(
- '@openstreetmap' => 'http://www.openstreetmap.org/copyright',
- '@ccbysa' => 'http://creativecommons.org/licenses/by-sa/2.0/',
- )
- ),
- 'projection' => array('900913'),
- 'layer_type' => 'openlayers_layer_type_xyz',
- 'url' => '//tile.openstreetmap.org/${z}/${x}/${y}.png',
- 'wrapDateLine' => TRUE,
- );
- $layers[$layer->name] = $layer;
- // OpenStreetMap Cycling Map
- $layer = new stdClass();
- $layer->api_version = 1;
- $layer->name = 'osm_cycle';
- $layer->title = 'OSM Cycling Map';
- $layer->description = 'OpenStreetMap with highlighted bike lanes';
- $layer->data = array(
- 'isBaseLayer' => TRUE,
- 'attribution' => t('©<a href="@ccbysa">CCBYSA</a> '.
- '<a href="@openstreetmap">© OpenStreetMap contributors</a>',
- array(
- '@openstreetmap' => 'http://www.openstreetmap.org/copyright',
- '@ccbysa' => 'http://creativecommons.org/licenses/by-sa/2.0/',
- )
- ),
- 'projection' => array('900913'),
- 'layer_type' => 'openlayers_layer_type_xyz',
- 'url' => '//a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png',
- 'wrapDateLine' => TRUE,
- );
- $layers[$layer->name] = $layer;
- // OpenStreetMap 426 hybrid overlay
- $layer = new stdClass();
- $layer->api_version = 1;
- $layer->name = 'osm_4326_hybrid';
- $layer->title = 'OSM Overlay';
- $layer->description = 'Semi-transparent hybrid overlay. Projected into
- WSG84 for use on non spherical-mercator maps.';
- $layer->data = array(
- 'isBaseLayer' => FALSE,
- 'attribution' => t('©<a href="@ccbysa">CCBYSA</a> '.
- '<a href="@openstreetmap">© OpenStreetMap contributors</a>',
- array(
- '@openstreetmap' => 'http://www.openstreetmap.org/copyright',
- '@ccbysa' => 'http://creativecommons.org/licenses/by-sa/2.0/',
- )
- ),
- 'projection' => array('4326'),
- 'layer_type' => 'openlayers_layer_type_wms',
- 'url' => 'http://oam.hypercube.telascience.org/tiles',
- 'params' => array(
- 'isBaseLayer' => FALSE,
- 'layers' => 'osm-4326-hybrid',
- ),
- 'options' => array(
- 'buffer' => 1,
- ),
- );
- $layers[$layer->name] = $layer;
- /* Example with KML layer */
- $layer = new stdClass();
- $layer->disabled = FALSE; /* Edit this to true to make a default openlayers_layers disabled initially */
- $layer->api_version = 1;
- $layer->name = 'openlayers_kml_example';
- $layer->title = 'KML Example Layer';
- $layer->description = 'A simple example of KML Layer Type.';
- $layer->data = array(
- 'method' => 'raw',
- 'raw' => '<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Placemark><name>Simple placemark</name><description>Attached to the ground. Intelligently places itself at the height of the underlying terrain.</description><Point><coordinates>-122.0822035425683,37.42228990140251,0</coordinates></Point></Placemark></kml>',
- 'formatOptions' => array(
- 'extractStyles' => TRUE,
- 'extractTracks' => FALSE,
- 'extractAttributes' => TRUE,
- ),
- 'projection' => array(
- 0 => '4326',
- ),
- 'isBaseLayer' => 0,
- 'layer_type' => 'openlayers_layer_type_kml',
- 'layer_handler' => 'kml',
- 'vector' => TRUE,
- );
- $layers[$layer->name] = $layer;
- // MetaCarts base map
- $layer = new stdClass();
- $layer->api_version = 1;
- $layer->name = 'wms_default';
- $layer->title = 'Default OpenLayers WMS';
- $layer->description = 'MetaCarta basemap of province and water boundaries';
- $layer->data = array(
- 'projection' => array('4326'),
- 'isBaseLayer' => TRUE,
- 'layer_type' => 'openlayers_layer_type_wms',
- 'base_url' => '//labs.metacarta.com/wms-c/Basic.py',
- 'params' => array(
- 'isBaseLayer' => TRUE,
- ),
- 'options' => array(
- 'layers' => array('basic'),
- 'maxExtent' => openlayers_get_extent('4326'),
- ),
- );
- $layers[$layer->name] = $layer;
- // GeoJSON example with direct data
- $layer = new stdClass();
- $layer->api_version = 1;
- $layer->name = 'openlayers_geojson_picture_this';
- $layer->title = t('Example GeoJSON, "Picture This"');
- $layer->description = t('Example that puts GeoJSON directly in layer without Views.');
- $layer->data = array(
- 'resolutions' => openlayers_get_resolutions('900913'),
- 'serverResolutions' => openlayers_get_resolutions('4326'),
- 'layer_type' => 'openlayers_layer_type_geojson',
- 'layer_handler' => 'geojson',
- 'projection' => array('4326'),
- 'isBaseLayer' => FALSE,
- 'vector' => TRUE,
- 'geojson_data' => '
- {
- "type": "Feature",
- "properties": {
- "name": "' . t('Picture This') . '",
- "description": "' . t('Outside of the North Carolina Museum of Art.') . '"
- },
- "geometry": {
- "type": "Point",
- "coordinates": [
- -78.702798,
- 35.809411
- ]
- },
- "crs": {
- "type": "name",
- "properties": {
- "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
- }
- }
- }
- ',
- );
- $layers[$layer->name] = $layer;
- $info = _mapbox_layers_info();
- $resolutions = array_combine(range(0, 21), openlayers_get_resolutions('900913'));
- foreach ($info as $key => $item) {
- $openlayers_layers = new stdClass;
- $openlayers_layers->disabled = FALSE; /* Edit this to true to make a default openlayers_layers disabled initially */
- $openlayers_layers->api_version = 1;
- $openlayers_layers->name = $key;
- $openlayers_layers->title = $item['name'];
- $openlayers_layers->description = $item['description'];
- $openlayers_layers->data = array(
- 'url' => array(
- 0 => 'http://a.tiles.mapbox.com/',
- 1 => 'http://b.tiles.mapbox.com/',
- 2 => 'http://c.tiles.mapbox.com/',
- 3 => 'http://d.tiles.mapbox.com/',
- ),
- 'layername' => $item['layername'],
- 'layer_type' => 'openlayers_layer_type_mapbox',
- 'osm' => FALSE,
- 'isBaseLayer' => TRUE,
- 'type' => 'png',
- 'resolutions' => array_intersect_key($resolutions, array_flip(range($item['minzoom'], $item['maxzoom']))),
- 'projection' => array('900913'),
- );
- $layers[$key] = $openlayers_layers;
- }
- return $layers;
- }
- /**
- * This function is for the po editor to be able to find these strings,
- * since in the codebase they are not in t()'s, because they are later
- * run through t() in the layer loader function
- */
- function _openlayers_openlayers_layers_i18n() {
- $translatable_strings = array(
- // titles
- t('Google Maps Satellite'),
- t('Google Maps Hybrid'),
- t('Google Maps Normal'),
- t('Google Maps Physical'),
- t('Bing Road'),
- t('Bing Aerial'),
- t('Bing Hybrid'),
- t('Yahoo Maps Street'),
- t('Yahoo Maps Hybrid'),
- t('Yahoo Maps Satellite'),
- t('OSM Mapnik'),
- t('OSM Cycling Map'),
- t('OSM Overlay'),
- t('Default OpenLayers WMS'),
- // descriptions
- t('Alternative, community-rendered OpenStreetMap'),
- t('Google Maps Hillshades'),
- t('Google Maps Satellite Imagery.'),
- t('Google Maps with roads and terrain.'),
- t('MetaCarta basemap of province and water boundaries'),
- t('OpenStreetMap with highlighted bike lanes'),
- t('Semi-transparent hybrid overlay. Projected into
- WSG84 for use on non spherical-mercator maps.'),
- t('Standard Google Maps Roads'),
- t('The main OpenStreetMap map'),
- t('Bing Road tiles.'),
- t('Bing Aerial tiles.'),
- t('Bing Hybrid tiles.'),
- t('Yahoo hybrid of streets and satellite tiles.'),
- t('Yahoo satellite imagery tiles.'),
- t('Yahoo streets tiles.'),
- t('MapQuest’s rendering of OpenStreetMap.'),
- t('MapQuest’s aerial photo map.'),
- );
- }
- function _mapbox_layers_info() {
- $info = array();
- $info['mapbox_streets'] = array(
- 'name'=> t('MapBox Streets'),
- 'description' => t('MapBox Streets'),
- 'layername' => 'mapbox-streets',
- 'minzoom' => 0,
- 'maxzoom' => 16
- );
- $info['mapbox_world_bright'] = array(
- 'name' => t('MapBox World Bright'),
- 'description' => t('MapBox World Bright'),
- 'layername' => 'world-bright',
- 'minzoom' => 0,
- 'maxzoom' => 11,
- );
- $info['mapbox_world_dark'] = array(
- 'name' => t('MapBox World Dark'),
- 'description' => t('MapBox World Dark'),
- 'layername' => 'world-dark',
- 'minzoom' => 0,
- 'maxzoom' => 11,
- );
- $info['mapbox_world_light'] = array(
- 'name' => t('MapBox World Light'),
- 'description' => t('MapBox World Light'),
- 'layername' => 'world-light',
- 'minzoom' => 0,
- 'maxzoom' => 11,
- );
- $info['mapbox_world_print'] = array(
- 'name' => t('MapBox World Print'),
- 'description' => t('MapBox World Print'),
- 'layername' => 'world-print',
- 'minzoom' => 0,
- 'maxzoom' => 9,
- );
- $info['mapbox_world_black'] = array(
- 'name' => t('MapBox World Black'),
- 'description' => t('MapBox World Black'),
- 'layername' => 'world-black',
- 'minzoom' => 0,
- 'maxzoom' => 11,
- );
- return $info;
- }
|