4

I need to filter an OpenLayers layer using a CQL filter to an specific Bounding Box. Is it possible?

Something like this isn't working:

igh > 5000 AND bbox(igh,20786691,22051867,-305577260,-306370356)
7

Which mapserver are you running/requesting maps from?

According to Geoserver CQL Tutorial:

CQL provides a full set of geometric filter capabilities. Say, for example, you want to display only the states that do cross the (-90,40,-60,45) bounding box. The filter will be BBOX(the_geom, -90, 40, -60, 45)

  • Thanks for your response underdark. It's GeoServer 2.0.2 – Fran Verona Jan 30 '11 at 15:48
  • Isn't 'igh' some random attribute and not the geometry? – underdark Jan 30 '11 at 16:46
  • 'igh' is just a variable associated to the maps – Fran Verona Jan 30 '11 at 16:51
  • 1
    Do you use PostGIS as a data source for that layer? Does the geometry column have a different name there? – underdark Jan 31 '11 at 12:52
  • 1
    I asked to my technical OGC this morning, and he told me that 'the_geom' is called 'location'. Using it instead of 'the_geom' now works. Thanks underdark! Problem solved – Fran Verona Feb 2 '11 at 19:13
1

For anyone else figuring out how to use BBOX AND CQL filter with ~version 2.10+. You want to do something like:

/geoserver/eis/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=[layer name]&outputFormat=application%2Fjson&srsName=EPSG:4283&maxFeatures=100&cql_filter=BBOX([GEOM_FIELD]],151.09596,-33.609279,151.336939,-33.479914)%20AND%20status=%27active%27

replace [GEOM_FIELD]

So this was restricting with: BBOX(the_geom,151.09596,-33.609279,151.336939,-33.479914) AND status='active' Hope that helps, the documentation on this is quite terse

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.