Skip to content

Commit b344762

Browse files
committed
saving changes at the end fo the day again
1 parent 174e9c5 commit b344762

1 file changed

Lines changed: 44 additions & 2 deletions

File tree

learning_web_proj/cum_effects/wfsQuery.html

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,50 @@
1515
<!-- <script src="http://d3js.org/d3.v3.min.js"></script> --> <script src="../lib/OpenLayers.js"></script>
1616

1717
<script>
18-
// need to see if I can put together a manual query to a wfs layer
19-
18+
OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
2019

20+
/// shows what I want to do: http://wygoda.net/blog/wfs-without-map-with-openlayers
21+
// need to see if I can put together a manual query to a wfs layer
22+
wfsProtocolParams = {
23+
url : "http://subban.no-ip.biz/geoserver/wfs",
24+
version : "1.1.0",
25+
featureType : "mule_deer",
26+
featurePrefix : 'cum_effects',
27+
srsName : 'EPSG:900913'
28+
};
29+
protocol = new OpenLayers.Protocol.WFS(wfsProtocolParams);
30+
// then protocol.read()
31+
attributeFilter = new OpenLayers.Filter.Comparison({
32+
type : OpenLayers.Filter.Comparison.NOT_EQUAL_TO,
33+
property : 'RISK',
34+
value : 'NOT APPLICABLE'
35+
});
36+
37+
// next spatial filter, and combine with the filter above
38+
polygonDrawn = 'POLYGON((-13445733.370537 6369380.0116477,-13443019.856033 6369571.1042184,-13442331.922779 6367354.4303985,-13444816.126198 6366972.2452571,-13445733.370537 6369380.0116477))';
39+
spatialFilterParams = {
40+
type : OpenLayers.Filter.Spatial.INTERSECTS,
41+
value : polygonDrawn,
42+
projection : new OpenLayers.Projection('EPSG:900913')
43+
};
44+
filter_spatial = new OpenLayers.Filter.Spatial(spatialFilterParams);
45+
combinedFilter = new OpenLayers.Filter.Logical({
46+
filters : [attributeFilter, filter_spatial],
47+
type : OpenLayers.Filter.Logical.AND
48+
});
49+
50+
protocol.read({
51+
filter: combinedFilter,
52+
callback: function(response) {
53+
console.log("callback called");
54+
console.log("response.features" + response.features);
55+
if(response.features.length > 0) {
56+
console.log(response.features);
57+
} else {
58+
console.log('Whoops, no features returned!');
59+
}
60+
}
61+
});
62+
console.log("here");
2163
</script>
2264
</body>

0 commit comments

Comments
 (0)