GeoWebCache

Changes between Version 14 and Version 15 of google_maps

Show
Ignore:
Timestamp:
11/09/09 18:38:19 (10 months ago)
Author:
arneke (IP: 88.163.0.55)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • google_maps

    v14 v15  
    1 == Google Maps integration == 
     1= DEPRECATED = 
    22 
    3 !GeoWebCache can support [http://maps.google.com Google Maps] clients. 
    4  
    5 Please see the [http://code.google.com/apis/maps/ Google Maps API] documentation on details on creating custom Google Maps demos.  To integrate a layer served by !GeoWebCache with Google Maps, you can use the example below. 
    6  
    7 == Layer Definition == 
    8 To use !GeoWebCache you only need to add a layer to your client: 
    9 {{{ 
    10 var tilelayer =  new GTileLayer(null, null, null, { 
    11                      tileUrlTemplate: 'http://EXAMPLE.COM:PORT/GEOWEBCACHE_PATH/service/gmaps?layers=YOUR_LAYER&zoom={Z}&x={X}&y={Y}',  
    12                      isPng:true, 
    13                      opacity:0.5 } ); 
    14 }}} 
    15  
    16 Update the URL above and set the opacity as desired. It is also possible to specify an optional format=image/jpeg parameter. 
    17  
    18  
    19 == Complete Example == 
    20 {{{ 
    21 <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    22 <html xmlns="http://www.w3.org/1999/xhtml"> 
    23     <head> 
    24         <meta http-equiv="content-type" content="text/html; charset=utf-8"/> 
    25         <title>Google Maps with GeoWebCache</title> 
    26         <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=GOOGLE_MAPS_API_KEY'></script> 
    27         <script type="text/javascript"> 
    28  
    29             function initialize() {   
    30                 if (GBrowserIsCompatible()) { 
    31                     var map = new GMap2(document.getElementById("map_canvas")); 
    32                     map.setCenter(new GLatLng(39, -96), 4); 
    33                  
    34                     var tilelayer =  new GTileLayer(null, null, null, { 
    35                         tileUrlTemplate: 'http://EXAMPLE.COM:PORT/GEOWEBCACHE_PATH/service/gmaps?layers=YOUR_LAYER&zoom={Z}&x={X}&y={Y}',  
    36                         isPng:true, 
    37                         opacity:0.5 } 
    38                         ); 
    39                     
    40                     var myTileLayer = new GTileLayerOverlay(tilelayer); 
    41                     map.addOverlay(myTileLayer); 
    42       } 
    43     } 
    44  
    45         </script> 
    46     </head> 
    47     <body onload="initialize()" onunload="GUnload()"> 
    48         <div id="map_canvas" style="width: 500px; height: 300px"></div> 
    49     </body> 
    50 </html> 
    51 }}} 
    52  
    53 '''A few notes on the above template, where 2. is the only GeoWebCache specific part:''' 
    54  
    55 1. 
    56 {{{ 
    57 <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=GOOGLE_MAPS_API_KEY'></script> 
    58 }}} 
    59 Replace the string GOOGLE_MAPS_API_KEY with a valid Google Maps API key.  [http://code.google.com/apis/maps/signup.html Sign up for a key.] 
    60  
    61 2. 
    62 {{{ 
    63 tileUrlTemplate: 'http://EXAMPLE.COM:PORT/GEOWEBCACHE_PATH/service/gmaps?layers=YOUR_LAYER&zoom={Z}&x={X}&y={Y}',  
    64 }}} 
    65 This line is where the URL containing the layer served by !GeoWebCache is explicitly invoked.  Change EXAMPLE.COM:PORT to your website and port number.  Change GEOWEBCACHE_PATH to the path of your !GeoWebCache instance (Examples:  /geowebcache or /geoserver/gwc ).  Change YOUR_LAYER to the name of your layer (Example: topp:states) 
    66  
    67 3. 
    68 {{{ 
    69 map.setCenter(new GLatLng(39, -96), 4); 
    70 }}} 
    71 This will start the map at zoom level 4, centered at -96 degrees longitude and 39 degrees latitude. 
    72  
    73 For more information on syntax in this example, please see the [http://code.google.com/apis/maps/ Google Maps API] documentation. 
    74  
    75  
    76  
    77 '''Without caching''' 
    78  
    79 If you are running version 1.0.1 or greater and the layer, or the global configuration, has been configured with <cacheBypassAllowed>, then you may append {{{&cached=false}}} to the above URL template. This will effectively disable caching and hit the backend server with every request, reducing GeoWebCache to a simple translator. Additionally, you may specify {{{&metatiled=false}}} so that the WMS requests to the backend are not made with {{{tiled=true}}} 
     3This document is deprecated, please see http://geowebcache.org/docs/1.2.0