@@ -40,70 +40,48 @@ public static function layers_js($all = FALSE)
// Get OpenLayers type
$ openlayers_type = $ layers [$ default_map ]->openlayers ;
// To store options for the bing maps
$ bing_options = "{}" ;
foreach ($ layers as $ layer )
{
if ($ layer ->active )
{
if ($ all == TRUE )
// Get the bing options
if ($ layer ->openlayers == "Bing" )
{
$ js .= "var " .$ layer ->name ." = new OpenLayers.Layer." .$ layer ->openlayers ."(\"" .$ layer ->title ."\", " ;
// Options for the Bing layer constructor
$ bing_options = "{\n"
. "\t name: \"" .$ layer ->data ['name' ]."\",\n"
. "\t type: \"" .$ layer ->data ['type' ]."\",\n"
. "\t key: \"" .$ layer ->data ['key' ]."\"\n"
. "}" ;
}
if ($ layer ->openlayers == 'XYZ' )
if ($ all == TRUE )
{
//++ Bing doesn't have the first argument
if ($ layer ->openlayers == "Bing" )
{
if (isset ($ layer ->data ['url' ]))
{
$ js .= '"' .$ layer ->data ['url' ].'", ' ;
}
}
$ js .= "{ \n" ;
foreach ($ layer ->data AS $ key => $ value )
{
if ( ! empty ($ value )
AND $ key != 'baselayer'
AND ($ key == 'attribution' AND $ layer ->openlayers == 'XYZ' )
AND $ key != 'url' )
{
if ($ key == "type" )
{
$ js .= " " .$ key .": " .urlencode ($ value ).",\n" ;
}
else
{
$ js .= " " .$ key .": '" .urlencode ($ value )."',\n" ;
}
}
$ js .= "var " .$ layer ->name ." = new OpenLayers.Layer." .$ layer ->openlayers ."($bing_options);\n\n" ;
}
$ js .= " sphericalMercator: true,\n" ;
$ js .= " maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)});\n\n" ;
}
else
{
if ($ layer ->openlayers == $ openlayers_type )
else
{
$ js .= "var " .$ layer ->name ." = new OpenLayers.Layer." .$ layer ->openlayers ."(\"" .$ layer ->title ."\", " ;
if ($ layer ->openlayers == 'XYZ' )
{
if (isset ($ layer ->data ['url' ]))
{
$ js .= '"' .$ layer ->data ['url' ].'", ' ;
}
}
$ js .= "{ \n" ;
$ js .= "var " .$ layer ->name ." = new OpenLayers.Layer." .$ layer ->openlayers ."(\"" .$ layer ->title ."\", { \n" ;
foreach ($ layer ->data AS $ key => $ value )
{
if ( ! empty ($ value )
if
( ! empty ($ value )
AND $ key != 'baselayer'
AND ($ key == 'attribution' AND $ layer ->openlayers == 'XYZ' )
AND $ key != 'url' )
AND $ key != 'url'
)
{
if ($ key == "type" )
{
$ js .= " " .$ key .": " .urlencode ( $ value) .",\n" ;
$ js .= " " .$ key .": " .$ value .",\n" ;
}
else
{
@@ -115,6 +93,46 @@ public static function layers_js($all = FALSE)
$ js .= " sphericalMercator: true,\n" ;
$ js .= " maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)});\n\n" ;
}
}
else
{
if ($ layer ->openlayers == $ openlayers_type )
{
//++ Bing doesn't have the first argument
if ($ layer ->openlayers == "Bing" )
{
$ js .= "var " .$ layer ->name ." = new OpenLayers.Layer." .$ layer ->openlayers ."($bing_options);\n\n" ;
}
else
{
$ js .= "var " .$ layer ->name ." = new OpenLayers.Layer." .$ layer ->openlayers ."(\"" .$ layer ->title ."\", { \n" ;
foreach ($ layer ->data AS $ key => $ value )
{
if
(
! empty ($ value )
AND $ key != 'baselayer'
AND ($ key == 'attribution' AND $ layer ->openlayers == 'XYZ' )
AND $ key != 'url'
)
{
if ($ key == "type" )
{
$ js .= " " .$ key .": " .$ value .",\n" ;
}
else
{
$ js .= " " .$ key .": '" .urlencode ($ value )."',\n" ;
}
}
}
$ js .= " sphericalMercator: true,\n" ;
$ js .= " maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)});\n\n" ;
}
}
}
}
}
@@ -257,7 +275,7 @@ public static function base($layer_name = NULL)
);
$ layers [$ layer ->name ] = $ layer ;
// Google Satellite
// GOOGLE Satellite
$ layer = new stdClass();
$ layer ->active = TRUE ;
$ layer ->name = 'google_satellite' ;
@@ -272,7 +290,7 @@ public static function base($layer_name = NULL)
);
$ layers [$ layer ->name ] = $ layer ;
// Google Hybrid
// GOOGLE Hybrid
$ layer = new stdClass();
$ layer ->active = TRUE ;
$ layer ->name = 'google_hybrid' ;
@@ -287,7 +305,7 @@ public static function base($layer_name = NULL)
);
$ layers [$ layer ->name ] = $ layer ;
// Google Normal
// GOOGLE Normal
$ layer = new stdClass();
$ layer ->active = TRUE ;
$ layer ->name = 'google_normal' ;
@@ -302,7 +320,7 @@ public static function base($layer_name = NULL)
);
$ layers [$ layer ->name ] = $ layer ;
// Google Physical
// GOOGLE Physical
$ layer = new stdClass();
$ layer ->active = TRUE ;
$ layer ->name = 'google_physical' ;
@@ -317,45 +335,51 @@ public static function base($layer_name = NULL)
);
$ layers [$ layer ->name ] = $ layer ;
// Bing Street
// BING Road
$ layer = new stdClass();
$ layer ->active = FALSE ;
$ layer ->name = 'virtualearth_street ' ;
$ layer ->openlayers = "VirtualEarth " ;
$ layer ->title = 'Bing Street ' ;
$ layer ->description = 'Bing Street Tiles. ' ;
$ layer ->api_url = 'https://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6 ' ;
$ layer ->active = TRUE ;
$ layer ->name = 'bing_road ' ;
$ layer ->openlayers = "Bing " ;
$ layer ->title = 'Bing-Road ' ;
$ layer ->description = 'Bing Road Maps ' ;
$ layer ->api_signup = 'https://www.bingmapsportal.com/ ' ;
$ layer ->data = array (
'name' => 'Bing-Road' ,
'baselayer' => TRUE ,
'type' => 'VEMapStyle.Road' ,
'key' => Kohana ::config ('settings.api_live' ),
'type' => 'Road' ,
);
$ layers [$ layer ->name ] = $ layer ;
// Bing Satellite
// BING Hybrid
$ layer = new stdClass();
$ layer ->active = TRUE ;
$ layer ->name = 'virtualearth_satellite ' ;
$ layer ->openlayers = "VirtualEarth " ;
$ layer ->title = 'Bing Satellite ' ;
$ layer ->description = 'Bing Satellite Tiles .' ;
$ layer ->api_url = 'https://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6 ' ;
$ layer ->name = 'bing_hybrid ' ;
$ layer ->openlayers = "Bing " ;
$ layer ->title = 'Bing-Hybrid ' ;
$ layer ->description = 'Bing hybrid of streets and satellite tiles .' ;
$ layer ->api_signup = 'https://www.bingmapsportal.com/ ' ;
$ layer ->data = array (
'name' => 'Bing-Hybrid' ,
'baselayer' => TRUE ,
'type' => 'VEMapStyle.Aerial' ,
'key' => Kohana ::config ('settings.api_live' ),
'type' => 'AerialWithLabels' ,
);
$ layers [$ layer ->name ] = $ layer ;
// Bing Hybrid
// BING Aerial
$ layer = new stdClass();
$ layer ->active = TRUE ;
$ layer ->name = 'virtualearth_hybrid ' ;
$ layer ->openlayers = "VirtualEarth " ;
$ layer ->title = 'Bing Hybrid ' ;
$ layer ->description = 'Bing hybrid of streets and satellite tiles. ' ;
$ layer ->api_url = 'https://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6 ' ;
$ layer ->name = 'bing_satellite ' ;
$ layer ->openlayers = "Bing " ;
$ layer ->title = 'Bing-Satellite ' ;
$ layer ->description = 'Bing Satellite Tiles ' ;
$ layer ->api_signup = 'https://www.bingmapsportal.com/ ' ;
$ layer ->data = array (
'name' => 'Bing-Satellite' ,
'baselayer' => TRUE ,
'type' => 'VEMapStyle.Hybrid' ,
'key' => Kohana ::config ('settings.api_live' ),
'type' => 'Aerial' ,
);
$ layers [$ layer ->name ] = $ layer ;
@@ -376,28 +400,11 @@ public static function base($layer_name = NULL)
);
$ layers [$ layer ->name ] = $ layer ;
// OpenStreetMap Tiles @ Home
$ layer = new stdClass();
$ layer ->active = TRUE ;
$ layer ->name = 'osm_tah' ;
$ layer ->openlayers = "OSM.Mapnik" ;
$ layer ->title = 'OSM Tiles@Home' ;
$ layer ->description = 'Alternative, community-rendered OpenStreetMap' ;
$ layer ->api_url = 'https://www.openstreetmap.org/openlayers/OpenStreetMap.js' ;
$ layer ->data = array (
'baselayer' => TRUE ,
'attribution' => '©<a href="@ccbysa">CCBYSA</a> 2010
<a href="@openstreetmap">OpenStreetMap.org</a> contributors' ,
'url' => 'http://tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png' ,
'type' => ''
);
$ layers [$ layer ->name ] = $ layer ;
// OpenStreetMap Cycling Map
$ layer = new stdClass();
$ layer ->active = TRUE ;
$ layer ->name = 'osm_cycle' ;
$ layer ->openlayers = "OSM.Mapnik " ;
$ layer ->openlayers = "OSM.CycleMap " ;
$ layer ->title = 'OSM Cycling Map' ;
$ layer ->description = 'OpenStreetMap with highlighted bike lanes' ;
$ layer ->api_url = 'https://www.openstreetmap.org/openlayers/OpenStreetMap.js' ;
@@ -410,30 +417,6 @@ public static function base($layer_name = NULL)
);
$ layers [$ layer ->name ] = $ layer ;
// OpenStreetMap 426 hybrid overlay
$ layer = new stdClass();
$ layer ->active = FALSE ;
$ layer ->name = 'osm_4326_hybrid' ;
$ layer ->openlayers = "OSM.Mapnik" ;
$ layer ->title = 'OSM Overlay' ;
$ layer ->description = 'Semi-transparent hybrid overlay. Projected into
WSG84 for use on non spherical-mercator maps.' ;
$ layer ->api_url = 'https://www.openstreetmap.org/openlayers/OpenStreetMap.js' ;
$ layer ->data = array (
'baselayer' => FALSE ,
'attribution' => '©<a href="@ccbysa">CCBYSA</a> 2010
<a href="@openstreetmap">OpenStreetMap.org</a> contributors' ,
'url' => 'http://oam.hypercube.telascience.org/tiles' ,
'params' => array (
'layers' => 'osm-4326-hybrid' ,
),
'options' => array (
'isBaseLayer' => FALSE ,
'buffer' => 1 ,
),
'type' => ''
);
$ layers [$ layer ->name ] = $ layer ;
// Add Custom Layers
// Filter::map_base_layers