121 lines
5.9 KiB
HTML
121 lines
5.9 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
|
<title>Layer exploration app for GFW</title>
|
|
<link rel="shortcut icon" href="http://cartodb.com/favicon/favicon_32x32.ico" />
|
|
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
|
|
<link rel="stylesheet" href="lib/cartodb.css">
|
|
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
|
|
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
|
|
<script type="text/javascript" src="lib/wax.g.js"></script>
|
|
<script type="text/javascript" src="lib/cartodb-gmapsv3.js"></script>
|
|
<script type="text/javascript" src="lib/dat.gui.min.js"></script>
|
|
<script type="text/javascript" src="lib/underscore-min.js"></script>
|
|
<script type="text/javascript" src="lib/backbone.js"></script>
|
|
<script type="text/javascript" src="lib/class.js"></script>
|
|
<script type="text/javascript" src="lib/backbone.cartodb.js"></script>
|
|
<script type="text/javascript" src="src/gfw.js"></script>
|
|
<script type="text/javascript">
|
|
var gui;
|
|
function initialize() {
|
|
|
|
// initialise the google map
|
|
var map = new google.maps.Map(document.getElementById('map_canvas'), {
|
|
center: new google.maps.LatLng(0,110),
|
|
zoom: 5,
|
|
mapTypeId: google.maps.MapTypeId.SATELLITE,
|
|
mapTypeControl: false
|
|
});
|
|
|
|
var forestHeight = new google.maps.ImageMapType({
|
|
getTileUrl: function(ll, z) {
|
|
var X = ll.x % (1 << z); // wrap
|
|
return "http://api.tiles.mapbox.com/v3/cartodb.Forest-Height-Test/" + z + "/" + X + "/" + ll.y + ".png";
|
|
},
|
|
tileSize: new google.maps.Size(256, 256),
|
|
isPng: true,
|
|
maxZoom: 7,
|
|
name: "Forest Height",
|
|
alt: "Global forest height"
|
|
});
|
|
var forestSoft = new google.maps.ImageMapType({
|
|
getTileUrl: function(ll, z) {
|
|
var X = ll.x % (1 << z); // wrap
|
|
return "http://api.tiles.mapbox.com/v3/cartodb.global-forest-height/" + z + "/" + X + "/" + ll.y + ".png";
|
|
},
|
|
tileSize: new google.maps.Size(256, 256),
|
|
isPng: true,
|
|
maxZoom: 7,
|
|
name: "Forest Height",
|
|
alt: "Global forest height"
|
|
});
|
|
|
|
map.mapTypes.set('forests', forestHeight);
|
|
map.mapTypes.set('forests_soft', forestSoft);
|
|
var Road = function(){
|
|
this.Road = function(){
|
|
map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
|
|
map.setOptions({styles: null});
|
|
}
|
|
}
|
|
var Satellite = function(){
|
|
this.Satellite = function(){
|
|
map.setMapTypeId(google.maps.MapTypeId.SATELLITE);
|
|
map.setOptions({styles: null});
|
|
}
|
|
}
|
|
var Forest = function(){
|
|
this.Forest = function(){
|
|
map.setMapTypeId('forests');
|
|
map.setOptions({styles: null});
|
|
}
|
|
}
|
|
var ForestSoft = function(){
|
|
this.ForestSoft = function(){
|
|
map.setMapTypeId('forests_soft');
|
|
map.setOptions({styles: null});
|
|
}
|
|
}
|
|
|
|
var map_style = {};
|
|
map_style.google_maps_customization_style = [ { stylers: [ { saturation: -65 }, { gamma: 1.52 } ] }, { featureType: "administrative", stylers: [ { saturation: -95 },{ gamma: 2.26 } ] }, { featureType: "water", elementType: "labels", stylers: [ { visibility: "off" } ] }, { featureType: "administrative.locality", stylers: [ { visibility: 'off' } ] }, { featureType: "road", stylers: [ { visibility: "simplified" }, { saturation: -99 }, { gamma: 2.22 } ] }, { featureType: "poi", elementType: "labels", stylers: [ { visibility: "off" } ] }, { featureType: "road.arterial", stylers: [ { visibility: 'off' } ] }, { featureType: "road.local", elementType: "labels", stylers: [ { visibility: 'off' } ] }, { featureType: "transit", stylers: [ { visibility: 'off' } ] }, { featureType: "road", elementType: "labels", stylers: [ { visibility: 'off' } ] },{ featureType: "poi", stylers: [ { saturation: -55 } ] } ];
|
|
|
|
var Soft = function(){
|
|
this.Soft = function(){
|
|
map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
|
|
map.setOptions({styles: map_style.google_maps_customization_style});
|
|
}
|
|
}
|
|
|
|
dat.GUI.DEFAULT_WIDTH = 300;
|
|
gui = new dat.GUI();
|
|
var bl = gui.addFolder("Basemap Style");
|
|
bl.add(new Road(), 'Road');
|
|
bl.add(new Satellite(), 'Satellite');
|
|
bl.add(new Soft(), 'Soft').name('Soft toned');
|
|
bl.add(new Forest(), 'Forest').name('Forest height');
|
|
bl.add(new ForestSoft(), 'ForestSoft').name('Forest height (soft)');
|
|
|
|
map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
|
|
map.setOptions({styles: map_style.google_maps_customization_style});
|
|
GFW(function(env) {
|
|
GFW.app = new env.app.Instance(map, {
|
|
user : 'wri-01',
|
|
layerTable : 'layerinfo',
|
|
logging : true
|
|
});
|
|
GFW.app.run();
|
|
GFW.env = env;
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
<body onload="initialize()">
|
|
<div id="map_canvas"></div>
|
|
<a class="cartodb_logo" href="http://www.cartodb.com" target="_blank">CartoDB</a>
|
|
</body>
|
|
</html> |