File: wfs-filter.js

package info (click to toggle)
openlayers 2.13.1%2Bds2-10
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 67,252 kB
  • sloc: javascript: 61,721; xml: 7,435; python: 907; sh: 44; makefile: 19
file content (48 lines) | stat: -rw-r--r-- 1,685 bytes parent folder | download | duplicates (7)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
var map;

// use proxy if requesting features cross-domain
OpenLayers.ProxyHost= "proxy.cgi?url=";

function init() {

    map = new OpenLayers.Map({
        div: "map",
        layers: [
            new OpenLayers.Layer.WMS(
                "Natural Earth", 
                "http://demo.opengeo.org/geoserver/wms",
                {layers: "topp:naturalearth"}
            ),
            new OpenLayers.Layer.Vector("WFS", {
                strategies: [new OpenLayers.Strategy.BBOX()],
                protocol: new OpenLayers.Protocol.WFS({
                    url:  "http://demo.opengeo.org/geoserver/wfs",
                    featureType: "tasmania_roads",
                    featureNS: "http://www.openplans.org/topp"
                }),
                styleMap: new OpenLayers.StyleMap({
                    strokeWidth: 3,
                    strokeColor: "#333333"
                }),
                filter: new OpenLayers.Filter.Logical({
                    type: OpenLayers.Filter.Logical.OR,
                    filters: [
                        new OpenLayers.Filter.Comparison({
                            type: OpenLayers.Filter.Comparison.EQUAL_TO,
                            property: "TYPE",
                            value: "highway"
                        }),
                        new OpenLayers.Filter.Comparison({
                            type: OpenLayers.Filter.Comparison.EQUAL_TO,
                            property: "TYPE",
                            value: "road"
                        })
                    ]
                })
            })
        ],
        center: new OpenLayers.LonLat(146.7, -41.8),
        zoom: 6
    });

}