Virtual Earth integration
GeoWebCache can support Microsoft Virtual Earth clients.
Please see the Virtual Earth Interactive SDK for details on how to make your own client. To integrate a layer served by GeoWebCache with Virtual Earth, you can use the following HTML code as a template.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Virtual Earth with GeoWebCache</title>
<script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1"></script>
<script type="text/javascript">
var map, tileLayer;
var tileLayerURL = 'http://EXAMPLE.COM:PORT/GEOWEBCACHE_PATH/service/ve?quadkey=%4&format=image/png&layers=YOUR_LAYER';
function GetMap()
{
map = new VEMap('myMap');
map.LoadMap(new VELatLong(39,-96) ,4 ,'r' , false);
var tileSourceSpec = new VETileSourceSpecification('TITLE_OF_LAYER', tileLayerURL);
tileSourceSpec.Opacity = 0.5;
map.AddTileLayer(tileSourceSpec, true);
}
</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:relative; width:700px; height:500px;"></div>
A few notes on this template:
1.
var tileLayerURL = 'http://EXAMPLE.COM:PORT/GEOWEBCACHE_PATH/service/ve?quadkey=%4&format=image/png&layers=YOUR_LAYER';
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)
2.
map.LoadMap(new VELatLong(39,-96) ,4 ,'r' , false);
This line sets the default view to 39 lat --96 long, zoom level 4, which shows big regions of the world. It also loads Virtual Earth's 2D map engine by default. To load the 3D map engine by default, for the same location, change the line to the following
map.LoadMap(new VELatLong(39,-96), 4, 'r', false, VEMapMode.Mode3D, true);
3.
var tileSourceSpec = new VETileSourceSpecification('TITLE_OF_LAYER', tileLayerURL);
Replace TITLE_OF_LAYER with the name of your layer. This is a title, not code, so exact syntax isn't necessary here.
For more information on syntax in this example, please see the either the Virtual Earth Interactive SDK or the full Virtual Earth documentation.
Without caching
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