|
15 | 15 | <!-- <script src="http://d3js.org/d3.v3.min.js"></script> --> <script src="../lib/OpenLayers.js"></script> |
16 | 16 |
|
17 | 17 | <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="; |
20 | 19 |
|
| 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"); |
21 | 63 | </script> |
22 | 64 | </body> |
0 commit comments