Skip to content

Commit

Permalink
Add a single image WMS example
Browse files Browse the repository at this point in the history
  • Loading branch information
elemoine committed Mar 7, 2013
1 parent 71f0632 commit 02cbdde
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
52 changes: 52 additions & 0 deletions examples/wms-single-image.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!doctype html>
<html lang="en">
<head>
<meta 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="bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="examples.css" type="text/css">
<link rel="stylesheet" href="bootstrap/css/bootstrap-responsive.min.css" type="text/css">
<title>Single image WMS example</title>
</head>
<body>

<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="example-list.html">OpenLayers 3 Examples</a>
<ul class="nav pull-right">
<li><a href="https://github.com/openlayers/ol3"><i class="icon-github"></i></a></li>
<li><a href="https://twitter.com/openlayers"><i class="icon-twitter"></i></a></li>
</ul>
</div>
</div>
</div>

<div class="container-fluid">

<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>

<div class="row-fluid">

<div class="span4">
<h4 id="title">Single image WMS example</h4>
<p id="shortdesc">Example of a single image WMS layer.</p>
<div id="docs">
<p>See the <a href="wms-single-image.js" target="_blank">wms-single-image.js source</a> to see how this is done.</p>
</div>
<div id="tags">wms, image</div>
</div>

</div>

</div>

<script src="loader.js?id=wms-single-image" type="text/javascript"></script>

</body>
</html>
33 changes: 33 additions & 0 deletions examples/wms-single-image.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
goog.require('ol.Coordinate');
goog.require('ol.Extent');
goog.require('ol.Map');
goog.require('ol.RendererHint');
goog.require('ol.View2D');
goog.require('ol.layer.ImageLayer');
goog.require('ol.layer.TileLayer');
goog.require('ol.source.MapQuestOpenAerial');
goog.require('ol.source.SingleImageWMS');


var layers = [
new ol.layer.TileLayer({
source: new ol.source.MapQuestOpenAerial()
}),
new ol.layer.ImageLayer({
source: new ol.source.SingleImageWMS({
url: 'http://demo.opengeo.org/geoserver/wms',
crossOrigin: null,
params: {'LAYERS': 'topp:states'},
extent: new ol.Extent(-13884991, 2870341, -7455066, 6338219)
})
})
];
var map = new ol.Map({
renderer: ol.RendererHint.CANVAS,
layers: layers,
target: 'map',
view: new ol.View2D({
center: new ol.Coordinate(-10997148, 4569099),
zoom: 4
})
});

0 comments on commit 02cbdde

Please sign in to comment.