@@ -149,15 +149,31 @@ function update_lookangles(idx) {
149149
150150 var range_string = ( look . range < 10000 ) ? Math . round ( look . range ) + "m" : ( Math . round ( look . range / 100 ) / 10 ) + " km" ;
151151 $ ( "#lookanglesbox .range" ) . text ( range_string ) ;
152+ }
152153
154+ // map type list
155+ var maptypes = {
156+ osm : [ 'OSM' , 'OpenStreetMaps.org' , function ( xy , z ) { return 'http://a.tile.openstreetmap.org/' + z + '/' + xy . x + '/' + xy . y + '.png' ; } ] ,
157+ osm_toner : [ 'OSM Toner' , 'Stamen.org Toner' , function ( xy , z ) { return 'http://a.tile.stamen.com/toner/' + z + '/' + xy . x + '/' + xy . y + '.png' ; } ] ,
158+ osm_watercolor : [ 'OSM Watercolor' , 'Stamen.org Watercolor' , function ( xy , z ) { return 'http://c.tile.stamen.com/watercolor/' + z + '/' + xy . x + '/' + xy . y + '.png' ; } ] ,
159+ osm_bw : [ 'OSM B&W' , 'OSM Black & White' , function ( xy , z ) { return 'http://a.www.toolserver.org/tiles/bw-mapnik/' + z + '/' + xy . x + '/' + xy . y + '.png' ; } ] ,
153160}
154161
162+ // generate a list of names for the UI
163+ var maptype_ids = [ "roadmap" , "satellite" , "terrain" ]
164+ for ( var i in maptypes ) maptype_ids . push ( i ) ;
165+
166+
155167function load ( ) {
156168 //initialize map object
157169 map = new google . maps . Map ( document . getElementById ( 'map' ) , {
158170 zoom : 5 ,
159171 center : new google . maps . LatLng ( 53.467511 , - 2.2338940 ) ,
160172 mapTypeId : google . maps . MapTypeId . ROADMAP ,
173+ mapTypeControlOptions : {
174+ mapTypeIds : maptype_ids ,
175+ style : google . maps . MapTypeControlStyle . DROPDOWN_MENU
176+ } ,
161177 keyboardShortcuts : false ,
162178 streetViewControl : false ,
163179 rotateControl : false ,
@@ -169,7 +185,17 @@ function load() {
169185 } ,
170186 scrollwheel : true
171187 } ) ;
188+ // register custom map types
189+ for ( var i in maptypes ) {
190+ map . mapTypes . set ( i , new google . maps . ImageMapType ( {
191+ getTileUrl : maptypes [ i ] [ 2 ] ,
192+ tileSize : new google . maps . Size ( 256 , 256 ) ,
193+ maxZoom : 18 ,
194+ name : maptypes [ i ] [ 0 ]
195+ } ) ) ;
196+ }
172197
198+ // update current position if we geolocation is available
173199 if ( currentPosition ) updateCurrentPosition ( currentPosition . lat , currentPosition . lon ) ;
174200
175201 // initalize nite overlay
0 commit comments