Opened 13 years ago

Last modified 13 years ago

#4005 new defect

Postgres issue with maxFeature

Reported by: sbrunner Owned by: mapserverbugs
Priority: normal Milestone:
Component: WFS Server Version: 6.0
Severity: major Keywords:
Cc: sdlime, assefa

Description

I create a ticket related to this thread: http://lists.osgeo.org/pipermail/mapserver-users/2011-August /069727.html

In resume where we done a WFS query with a maxFeatures and a geometry filter, mapserver will done:

  • SQL query with the limit (max features) but not with the geometry filter
  • Filter internally the geometry

=> if the feature that we want to find is in the first elements (fax features) she will be return, otherwise => no result !

The only satisfactory workaround we found is to use a shapefile instance of PostGis !

Change History (4)

comment:2 by sbrunner, 13 years ago

Good enough SQL request is that in place of filtering on the mapflie extent it to filter on the geomerty extent, the best is to done the geometry filtering in postgis ;-).

Actual query (extent of the mapfile): select ... where geom && GeomFromText('POLYGON((620000 218000,620000 278000,690000 278000,690000 218000,620000 218000))',-1) limit 100

Better query (extent of the geometry): select ... where geom && GeomFromText('POLYGON((661070 244872,661071 244872,661071 244873,661070 244873,661070 244872))',-1) limit 100

Sincerely

comment:3 by sdlime, 13 years ago

Cc: sdlime assefa added

I'm guessing Assefa will be looking into this. I'd propose a general function that would determine if a filter is simple enough to derive an alternative extent. The queryByShape() methods do this since by definition they are simple.

This function, say msIsSimpleSpatialQuery() could look at a filter and derived the extent to be used (it would set map->query.extent). The function would be useful outside the WFS context. I think it would be something like:

1) set boolean var, that is "int isSimple=MS_TRUE" 2) loop through all tokens 3) if a token is not in a specific list of tokens (e.g. geometry literal, geometry binding, certain operators (e.g. intersects, and, or), etc...) then set isSimple=MS_FALSE and return. 4) if token is a geometry literal then save (or merge if multiple literals are encountered) 5) return isSimple and new extent...

Simple eh? The function would be called in msQueryByFilter().

Steve

comment:4 by sdlime, 13 years ago

See also #4011 for the maxFeatures issue. I think there are two issues at play here: maxFeature support and optimal spatial filtering.

Steve

Note: See TracTickets for help on using tickets.