Adding tiled WMS source

As shown in the example, this adds support for tiled WMS layers.
This commit is contained in:
ahocevar
2012-10-26 21:36:30 +02:00
parent d0e532eadf
commit 084506cdb5
6 changed files with 246 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../style.css" type="text/css">
<style type="text/css">
html, body, #map {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
</style>
<link rel="stylesheet" href="../../css/ol.css" type="text/css">
<title>ol3 full-screen demo</title>
<script src="../../build/ol.js" type="text/javascript"></script>
</head>
<body>
<div id="map"></div>
<script src="../wms.js" type="text/javascript"></script>
</body>
</html>
+47
View File
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<link rel="stylesheet" href="style.css" type="text/css">
<style type="text/css">
html, body, #map {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
#text {
position: absolute;
top: 8px;
right: 8px;
z-index: 20000;
background-color: white;
padding: 0 0.5em 0.5em 0.5em;
border-radius: 4px;
}
@media only screen and (max-width: 600px) {
#text {
display: none;
}
}
</style>
<title>wms example</title>
</head>
<body>
<div id="map">
<div id="text">
<h1 id="title">Tiled WMS example</h1>
<div id="shortdesc">Example of a tiled WMS layer.</div>
<div id="docs">
<p>See the
<a href="wms.js" target="_blank">wms.js source</a>
to see how this is done.</p>
</div>
</div>
</div>
<div id="tags">wms, tile, tilelayer</div>
<script src="loader.js?id=wms" type="text/javascript"></script>
</body>
</html>
+33
View File
@@ -0,0 +1,33 @@
goog.require('goog.debug.Console');
goog.require('goog.debug.Logger');
goog.require('goog.debug.Logger.Level');
goog.require('ol.Collection');
goog.require('ol.Coordinate');
goog.require('ol.Map');
goog.require('ol.source.MapQuestOpenAerial');
goog.require('ol.source.TiledWMS');
if (goog.DEBUG) {
goog.debug.Console.autoInstall();
goog.debug.Logger.getLogger('ol').setLevel(goog.debug.Logger.Level.INFO);
}
var layers = new ol.Collection([
new ol.layer.TileLayer({
source: new ol.source.MapQuestOpenAerial()
}),
new ol.layer.TileLayer({
source: new ol.source.TiledWMS({
url: 'http://demo.opengeo.org/geoserver/wms',
params: {'LAYERS': 'topp:states', 'TILED': true}
})
})
]);
var map = new ol.Map({
center: new ol.Coordinate(-10997148, 4569099),
layers: layers,
target: 'map',
zoom: 4
});