Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

now osm displays with google, but not the other way #1389

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 52 additions & 4 deletions application/helpers/map.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function layers_js($all = FALSE)
if ($layer->active)
{

if ($all == TRUE OR $layer->openlayers == $openlayers_type)
if ($all == TRUE OR $layer->openlayers == $openlayers_type )
{
//++ Bing doesn't have the first argument
if ($layer->openlayers == "Bing")
Expand All @@ -59,19 +59,19 @@ public static function layers_js($all = FALSE)
. "\t key: \"".$layer->data['key']."\"\n"
. "}";

$js .= "var ".$layer->name." = new OpenLayers.Layer.".$layer->openlayers."($bing_options);\n\n";
$js .= "var ".$layer->name." = new OpenLayers.Layer.".$layer->openlayers_class."($bing_options);\n\n";
}
// Allow layers to specify a custom set of OpenLayers options
// this should allow plugins to add OpenLayers Layer types we haven't considered here
// See http://dev.openlayers.org/docs/files/OpenLayers/Layer-js.html for other layer types
elseif (isset($layer->openlayers_options) AND $layer->openlayers_options != null)
{
$js .= "var ".$layer->name." = new OpenLayers.Layer.{$layer->openlayers}({$layer->openlayers_options});\n\n";
$js .= "var ".$layer->name." = new OpenLayers.Layer.{$layer->openlayers_class}({$layer->openlayers_options});\n\n";
}
// Finally construct JS for the majority of layers
else
{
$js .= "var ".$layer->name." = new OpenLayers.Layer.".$layer->openlayers."(\"".$layer->title."\", ";
$js .= "var ".$layer->name." = new OpenLayers.Layer.".$layer->openlayers_class."(\"".$layer->title."\", ";

if ($layer->openlayers == 'XYZ' || $layer->openlayers == 'WMS' || $layer->openlayers == 'TMS')
{
Expand Down Expand Up @@ -212,6 +212,7 @@ public static function base($layer_name = NULL)
$layer->active = TRUE;
$layer->name = 'esri_topo';
$layer->openlayers = "XYZ";
$layer->openlayers_class = "XYZ";
$layer->title = 'Esri World Topo Map';
$layer->description = 'This world topographic map (aka "the community basemap") includes boundaries, cities, water features, physiographic features, parks, landmarks, transportation, and buildings.';
$layer->api_url = '';
Expand All @@ -229,6 +230,7 @@ public static function base($layer_name = NULL)
$layer->active = TRUE;
$layer->name = 'esri_street';
$layer->openlayers = "XYZ";
$layer->openlayers_class = "XYZ";
$layer->title = 'Esri Street Map';
$layer->description = 'This map service presents highway-level data for the world and street-level data for North America, Europe, Southern Africa, parts of Asia, and more.';
$layer->api_url = '';
Expand All @@ -246,6 +248,7 @@ public static function base($layer_name = NULL)
$layer->active = TRUE;
$layer->name = 'esri_imagery';
$layer->openlayers = "XYZ";
$layer->openlayers_class = "XYZ";
$layer->title = 'Esri Imagery Map';
$layer->description = 'This map service presents satellite imagery for the world and high-resolution imagery for the United States, Great Britain, and hundreds of cities around the world.';
$layer->api_url = '';
Expand All @@ -263,6 +266,7 @@ public static function base($layer_name = NULL)
$layer->active = TRUE;
$layer->name = 'esri_natgeo';
$layer->openlayers = "XYZ";
$layer->openlayers_class = "XYZ";
$layer->title = 'Esri National Geographic Map';
$layer->description = 'This map is designed to be used as a general reference map for informational and educational purposes as well as a basemap by GIS professionals and other users for creating web maps and web mapping applications.';
$layer->api_url = '';
Expand All @@ -280,6 +284,23 @@ public static function base($layer_name = NULL)
$layer->active = TRUE;
$layer->name = 'google_satellite';
$layer->openlayers = "Google";
$layer->openlayers_class = "Google";
$layer->title = 'Google Maps Satellite';
$layer->description = 'Google Maps Satellite Imagery.';
$layer->api_url = 'https://maps.google.com/maps/api/js?v=3.7&sensor=false&language='.Kohana::config('locale.language.0');
$layer->data = array(
'baselayer' => TRUE,
'type' => 'google.maps.MapTypeId.SATELLITE',
'animationEnabled' => TRUE,
);
$layers[$layer->name] = $layer;

// GOOGLE Satellite for osm
$layer = new stdClass();
$layer->active = TRUE;
$layer->name = 'google_satellite_alt';
$layer->openlayers = "OSM.Mapnik";
$layer->openlayers_class = "Google";
$layer->title = 'Google Maps Satellite';
$layer->description = 'Google Maps Satellite Imagery.';
$layer->api_url = 'https://maps.google.com/maps/api/js?v=3.7&sensor=false&language='.Kohana::config('locale.language.0');
Expand All @@ -295,6 +316,7 @@ public static function base($layer_name = NULL)
$layer->active = TRUE;
$layer->name = 'google_hybrid';
$layer->openlayers = "Google";
$layer->openlayers_class = "Google";
$layer->title = 'Google Maps Hybrid';
$layer->description = 'Google Maps with roads and terrain.';
$layer->api_url = 'https://maps.google.com/maps/api/js?v=3.7&sensor=false&language='.Kohana::config('locale.language.0');
Expand All @@ -310,6 +332,7 @@ public static function base($layer_name = NULL)
$layer->active = TRUE;
$layer->name = 'google_normal';
$layer->openlayers = "Google";
$layer->openlayers_class = "Google";
$layer->title = 'Google Maps Normal';
$layer->description = 'Standard Google Maps Roads';
$layer->api_url = 'https://maps.google.com/maps/api/js?v=3.7&sensor=false&language='.Kohana::config('locale.language.0');
Expand All @@ -325,6 +348,7 @@ public static function base($layer_name = NULL)
$layer->active = TRUE;
$layer->name = 'google_physical';
$layer->openlayers = "Google";
$layer->openlayers_class = "Google";
$layer->title = 'Google Maps Physical';
$layer->description = 'Google Maps Hillshades';
$layer->api_url = 'https://maps.google.com/maps/api/js?v=3.7&sensor=false&language='.Kohana::config('locale.language.0');
Expand All @@ -340,6 +364,7 @@ public static function base($layer_name = NULL)
$layer->active = TRUE;
$layer->name = 'bing_road';
$layer->openlayers = "Bing";
$layer->openlayers_class = "Bing";
$layer->title = 'Bing-Road';
$layer->description = 'Bing Road Maps';
$layer->api_signup = Kohana::config('core.site_protocol').'://www.bingmapsportal.com/';
Expand All @@ -357,6 +382,7 @@ public static function base($layer_name = NULL)
$layer->active = TRUE;
$layer->name = 'bing_hybrid';
$layer->openlayers = "Bing";
$layer->openlayers_class = "Bing";
$layer->title = 'Bing-Hybrid';
$layer->description = 'Bing hybrid of streets and satellite tiles.';
$layer->api_signup = Kohana::config('core.site_protocol').'://www.bingmapsportal.com/';
Expand All @@ -374,6 +400,7 @@ public static function base($layer_name = NULL)
$layer->active = TRUE;
$layer->name = 'bing_satellite';
$layer->openlayers = "Bing";
$layer->openlayers_class = "Bing";
$layer->title = 'Bing-Satellite';
$layer->description = 'Bing Satellite Tiles';
$layer->api_signup = Kohana::config('core.site_protocol').'://www.bingmapsportal.com/';
Expand All @@ -391,6 +418,25 @@ public static function base($layer_name = NULL)
$layer->active = TRUE;
$layer->name = 'osm_mapnik';
$layer->openlayers = "OSM.Mapnik";
$layer->openlayers_class = "OSM.Mapnik";
$layer->title = 'OSM Mapnik';
$layer->description = 'The main OpenStreetMap map';
$layer->api_url = Kohana::config('core.site_protocol').'://www.openstreetmap.org/openlayers/OpenStreetMap.js';
$layer->data = array(
'baselayer' => TRUE,
'attribution' => '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>',
'url' => 'http://tile.openstreetmap.org/${z}/${x}/${y}.png',
'type' => '',
'transitionEffect' => 'resize',
);
$layers[$layer->name] = $layer;

// OpenStreetMap Mapnik for google
$layer = new stdClass();
$layer->active = TRUE;
$layer->name = 'osm_mapnik_alt';
$layer->openlayers = "Google";
$layer->openlayers_class = "OSM.Mapnik";
$layer->title = 'OSM Mapnik';
$layer->description = 'The main OpenStreetMap map';
$layer->api_url = Kohana::config('core.site_protocol').'://www.openstreetmap.org/openlayers/OpenStreetMap.js';
Expand All @@ -408,6 +454,7 @@ public static function base($layer_name = NULL)
$layer->active = TRUE;
$layer->name = 'osm_cycle';
$layer->openlayers = "OSM.CycleMap";
$layer->openlayers_class = "OSM.CycleMap";
$layer->title = 'OSM Cycling Map';
$layer->description = 'OpenStreetMap with highlighted bike lanes';
$layer->api_url = Kohana::config('core.site_protocol').'://www.openstreetmap.org/openlayers/OpenStreetMap.js';
Expand All @@ -425,6 +472,7 @@ public static function base($layer_name = NULL)
$layer->active = TRUE;
$layer->name = 'osm_TransportMap';
$layer->openlayers = "OSM.TransportMap";
$layer->openlayers_class = "OSM.TransportMap";
$layer->title = 'OSM Transport Map';
$layer->description = 'TransportMap';
$layer->api_url = Kohana::config('core.site_protocol').'://www.openstreetmap.org/openlayers/OpenStreetMap.js';
Expand Down
1 change: 1 addition & 0 deletions application/libraries/Themes.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public function requirements()
if ($this->map_enabled)
{
Requirements::js("media/js/OpenLayers.js");
Requirements::js("media/js/OpenStreetMap.js");
Requirements::js("media/js/ushahidi.js");
if ($this->api_url)
{
Expand Down