OpenLayers OpenLayers

Changeset 6498

Show
Ignore:
Timestamp:
03/12/08 11:34:05 (6 months ago)
Author:
tschaub
Message:

Since the name google.html should be reserved for our canonical Google example, I'm moving this reproject stuff into a google-reproject.html example. The google.html example now shows the various Google layers available. The google-reproject.html example demonstrates the reproject trick. I find examples with different indentation on every line a bit hard to read, so I'm straightening that out as well - and removing bits that were not used or not relevant to the examples.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/examples/google.html

    r6497 r6498  
    11<html xmlns="http://www.w3.org/1999/xhtml"> 
    22  <head> 
    3       <title>OpenLayers Google Layer Example</title> 
     3    <title>OpenLayers Google Layer Example</title> 
    44    <link rel="stylesheet" href="../theme/default/style.css" type="text/css" /> 
    55    <style type="text/css"> 
     
    88            height: 512px; 
    99            border: 1px solid black; 
    10             background-color: red; 
    1110        } 
    1211    </style> 
     
    1413    <!-- this gmaps key generated for http://openlayers.org/dev/ --> 
    1514    <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script> 
    16     <!-- Localhost key --> 
    17     <!-- <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTS6gjckBmeABOGXIUiOiZObZESPg'></script>--> 
    1815    <script src="../lib/OpenLayers.js"></script> 
    1916    <script type="text/javascript"> 
     
    2118        var lat = 40; 
    2219        var zoom = 17; 
    23         var map, layer
     20        var map
    2421 
    25         function init(){ 
    26             map = new OpenLayers.Map( 'map' , 
    27             { controls: [new OpenLayers.Control.MouseDefaults()] , 'numZoomLevels':20}); 
    28  
    29             var satellite = new OpenLayers.Layer.Google( "Google Satellite" , {type: G_SATELLITE_MAP, 'maxZoomLevel':18} ); 
     22        function init() { 
     23            map = new OpenLayers.Map('map'); 
     24            map.addControl(new OpenLayers.Control.LayerSwitcher()); 
     25             
     26            var gphy = new OpenLayers.Layer.Google( 
     27                "Google Physical", 
     28                {type: G_PHYSICAL_MAP} 
     29            ); 
     30            var gmap = new OpenLayers.Layer.Google( 
     31                "Google Streets" // the default 
     32            ); 
     33            var ghyb = new OpenLayers.Layer.Google( 
     34                "Google Hybrid", 
     35                {type: G_HYBRID_MAP} 
     36            ); 
     37            var gsat = new OpenLayers.Layer.Google( 
     38                "Google Satellite", 
     39                {type: G_SATELLITE_MAP} 
     40            ); 
    3041 
    3142 
    32             map.addLayers([satellite]); 
    33             layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", 
    34                     "http://labs.metacarta.com/wms/vmap0", {layers: 'basic', 'transparent':true}, 
    35                       {isBaseLayer: false} ); 
    36             layer.setVisibility(false); 
    37          var twms = new OpenLayers.Layer.WMS( "World Map", 
    38          "http://world.freemap.in/cgi-bin/mapserv?", 
    39                  {map: '/www/freemap.in/world/map/factbooktrans.map', transparent:'true', 
    40                          layers: 'factbook', 'format':'png'}, {'reproject': true} ); 
    41             map.addLayer(twms); 
     43            map.addLayers([gphy, gmap, ghyb, gsat]); 
    4244 
    43             map.setCenter(new OpenLayers.LonLat(10.205188,48.857593), 5); 
    44             map.addControl( new OpenLayers.Control.LayerSwitcher() ); 
    45             map.addControl( new OpenLayers.Control.PanZoomBar() ); 
     45            map.setCenter(new OpenLayers.LonLat(10.2, 48.9), 5); 
    4646        } 
    4747    </script> 
     
    5353 
    5454    <p id="shortdesc"> 
    55         Demonstrate a Google basemap used with boundary overlay layer
     55        Demonstrate use of the various types of Google layers
    5656    </p> 
    5757 
     
    5959 
    6060    <div id="docs"> 
    61       For best performance, you must be using a version of the Google Maps 
    62       API which is v2.93 or higher. In order to use this version of the API, 
    63       it is best to simply set your application to use the string "v=2" in 
    64       the request, rather than tying your application to an explicit version. 
     61        For best performance, you must be using a version of the Google Maps 
     62        API which is v2.93 or higher. In order to use this version of the API, 
     63        it is best to simply set your application to use the string "v=2" in 
     64        the request, rather than tying your application to an explicit version. 
    6565    </div> 
    6666  </body>