Hi,
the following is a snippet of a code I'm working with in OpenLayers. I can't figure out the Geoservers CQL-filtering (or the syntax of it in OL). If I put something non-spatial in it, like 'pnro BETWEEN 20000 AND 30000', it works. But I can't get any spatial filter working. Am I missing something? Wrong syntax perhaps or maybe something wrong with the projections or units?
- mika -
function abc() {
var url = wfs.getFullRequestString({
SERVICE: 'WFS',
VERSION: '1.1.0',
REQUEST: 'GetFeature',
OUTPUTFORMAT: 'json',
PROPERTYNAME: 'the_geom,pnro,kunta',
MAXFEATURES: 5,
TYPENAME: 'ssm:postinumerot',
SRSNAME: 'EPSG:900913',
CQL_FILTER: 'CONTAINS(the_geom, POINT(2458672.5016848585 8495454.347882228))',
RESULTTYPE: 'results'
},
"http://blaablaa.net/geoserver/wfs"
);
OpenLayers.loadURL(url,'',this,testJSON); });
Lehtonen, Mika ha scritto:
Hi,
the following is a snippet of a code I'm working with in OpenLayers. I can't figure out the Geoservers CQL-filtering (or the syntax of it in OL). If I put something non-spatial in it, like 'pnro BETWEEN 20000 AND 30000', it works. But I can't get any spatial filter working. Am I missing something? Wrong syntax perhaps or maybe something wrong with the projections or units?
- mika -
function abc() {
var url = wfs.getFullRequestString({
SERVICE: 'WFS',
VERSION: '1.1.0',
REQUEST: 'GetFeature',
OUTPUTFORMAT: 'json',
PROPERTYNAME: 'the_geom,pnro,kunta',
MAXFEATURES: 5,
TYPENAME: 'ssm:postinumerot',
SRSNAME: 'EPSG:900913',
CQL_FILTER: 'CONTAINS(the_geom, POINT(2458672.5016848585 8495454.347882228))',
RESULTTYPE: 'results'
},
"http://blaablaa.net/geoserver/wfs"
);
OpenLayers.loadURL(url,'',this,testJSON); });
I guess it's the units. I've tried to reproduce with topp
states and in fact the filter does not seem to be working
fine in a reprojected layer, but I don't have time to
investigate right now. Can you open a bug report on jira.codehaus.org?
Cheers
Andrea
--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.
Hi Andrea,
not sure anymore, if there's any problem though. I made two mistakes in my experiments. Firstly, I had a point feature which is projected into 900913, but the_geom is in 2393. Secondly, with wfs 1.1, x and y must be swapped with each other. After that, I get the right response. No need for JIRA, I guess?
- mika -
Andrea Aime kirjoitti:
Lehtonen, Mika ha scritto:
Hi,
the following is a snippet of a code I'm working with in OpenLayers. I can't figure out the Geoservers CQL-filtering (or the syntax of it in OL). If I put something non-spatial in it, like 'pnro BETWEEN 20000 AND 30000', it works. But I can't get any spatial filter working. Am I missing something? Wrong syntax perhaps or maybe something wrong with the projections or units?
- mika -
function abc() {
var url = wfs.getFullRequestString({
SERVICE: 'WFS',
VERSION: '1.1.0',
REQUEST: 'GetFeature',
OUTPUTFORMAT: 'json',
PROPERTYNAME: 'the_geom,pnro,kunta',
MAXFEATURES: 5,
TYPENAME: 'ssm:postinumerot',
SRSNAME: 'EPSG:900913',
CQL_FILTER: 'CONTAINS(the_geom, POINT(2458672.5016848585 8495454.347882228))',
RESULTTYPE: 'results'
},
"http://blaablaa.net/geoserver/wfs"
);
OpenLayers.loadURL(url,'',this,testJSON); });
I guess it's the units. I've tried to reproduce with topp
states and in fact the filter does not seem to be working
fine in a reprojected layer, but I don't have time to
investigate right now. Can you open a bug report on jira.codehaus.org?
Cheers
Andrea
Lehtonen, Mika ha scritto:
Hi Andrea,
not sure anymore, if there's any problem though. I made two mistakes in my experiments. Firstly, I had a point feature which is projected into 900913, but the_geom is in 2393. Secondly, with wfs 1.1, x and y must be swapped with each other. After that, I get the right response. No need for JIRA, I guess?
Ah, silly me, I did not actually read your request and thought you were
trying out GetFeatureInfo. Which is the one in which I replicated the issue. I've opened a jira for that one:
http://jira.codehaus.org/browse/GEOS-2330
Cheers
Andrea
--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.