summaryrefslogtreecommitdiff
path: root/misc/openlayers/examples/wfs-states.js
blob: c4e801e6cf9b5120734e5d980de028059a838bb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var map;
OpenLayers.ProxyHost = "proxy.cgi?url=";

function init() {
    // allow testing of specific renderers via "?renderer=Canvas", etc
    var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
    renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;

    map = new OpenLayers.Map({
        div: "map",
        layers: [
            new OpenLayers.Layer.WMS("OpenLayers WMS",
                "http://vmap0.tiles.osgeo.org/wms/vmap0",
                {layers: "basic"} 
            ),
            new OpenLayers.Layer.WMS("States WMS",
                "http://demo.opengeo.org/geoserver/wms",
                {layers: "topp:states", format: "image/png", transparent: true},
                {maxScale: 15000000}
            ),
            new OpenLayers.Layer.Vector("States", {
                minScale: 15000000,
                strategies: [new OpenLayers.Strategy.BBOX()],
                protocol: new OpenLayers.Protocol.WFS({
                    url: "http://demo.opengeo.org/geoserver/wfs",
                    featureType: "states",
                    featureNS: "http://www.openplans.org/topp"
                }),
                renderers: renderer
            })
        ],
        center: [-95.8506355, 37.163851],
        zoom: 3
    });
}