Files
openlayers/examples/wms.js
ahocevar b872b5a74f Cross origin handling to make example work in Firefox
The WMS used in the example does not send CORS headers (I think
not many WMS services do). It seems that the WebGL renderer
needs script access to the image data, so the example only works
with the DOM renderer in Firefox.
2012-10-27 09:16:09 +02:00

36 lines
895 B
JavaScript

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',
crossOrigin: null,
params: {'LAYERS': 'topp:states', 'TILED': true}
})
})
]);
var map = new ol.Map({
renderer: ol.RendererHint.DOM,
layers: layers,
target: 'map',
center: new ol.Coordinate(-10997148, 4569099),
zoom: 4
});