Reputation: 53
I need to execute a spatial INTERSECTS query between layers of type Point and Polygon, to find points that intersect with a polygon of attribute fclass == park.
CQL Query:
INTERSECTS(geom, collectGeometries(queryCollection('namespace_new:gis.osm_landuse_a_free_1', 'geom','fclass = park''')))";
I have defined a Vector layer and use WFS protocol to get data from Geoserver:
var layerDomainData = new OpenLayers.Layer.Vector("Tourist locations", {
// minScale: 15000000,
strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.WFS({
url: "http://localhost:8080/geoserver/wfs",
featureType: "tour_data",
featureNS: "http://localhost:8080/geoserver/namespace_new",
geometryName: "geom",
srsName: "EPSG:900913",
version: "1.1.0"
}),
styleMap: new OpenLayers.StyleMap({
'default' : domainStyle,
'select' : selectedDomainStyle
}),
renderers: renderer
});
Usually, I set spatial filters like:
layerDomainData.filter = new OpenLayers.Filter.Spatial({
type: OpenLayers.Filter.Spatial.DWITHIN,
property: "geom",
value: lineString, //selected feature on the map
distance: radius,
distanceUnits: "kilometers",
projection: "EPSG:4326"
});
but now i have to use Geoservers collectGeometries and queryCollection to select all the features from 'second' layer to intersect with my 'first' layer. If it was a WMS layer I would just set filter as a param (layer.params['CQL_FILTER'] = "filter_string"), but I don't know where to set the required filter when using WFS layer. Didn't find any example of using OpenLayers WFS with Geoserver cross-layer flters.
Any suggestions would be helpful.
Upvotes: 1
Views: 970