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/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/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/service). Change YOUR_LAYER to the name of your layer (Example: topp:states)
2.
map.LoadMap(new VELatLong(39,-96) ,4 ,'r' , false);
This line loads Virtual Earth's 2D map engine by default. To load the 3D map engine by default, change the this 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.
