[mapserver-dev] Re: WFS maxFeatures Support (sucks)...

Steve Lime sdlime at gmail.com
Wed Sep 7 10:55:34 EDT 2011


For those interested I created a new ticket to track this issue
specifically. See:

  http://trac.osgeo.org/mapserver/ticket/4011

I also attached a patch that moves result counting to the query
functions and removes it from the driver code. Still need to:

  - check on the drawing code although that should be localized to
msDrawVectorLayer()
  - check on the raster query code

One impact I don't understand is result paging with looks to be
WFS/PostGIS specific.

Steve

On Mon, Sep 5, 2011 at 7:56 AM, Steve Lime <sdlime at gmail.com> wrote:
> Hi all: I've been working on a ticket related to WFS filters and the
> maxFeatures parameter. Basically it just doesn't work, in fact it
> can't work as designed. The layer maxfeatures parameter is what's used
> and its purpose long ago was to limit the number of features drawn
> from a sorted (by size) data source. So, for instance, you'd see the
> 50 largest lakes in any map view.
>
> Not all drivers support it (SDE does not, OGR might not, SQL server
> does not, nor do tiled shapefiles) and all that do, apply that limit
> before checking filters (there's a comment to that effect in
> mapshape.c).
>
> Now its use needs to be much more precise. The best way to do that
> IMHO would be to handle the feature counting outside the drivers, in
> the msQueryBy...() functions and in msDrawLayer(). In the query
> functions the result cache already maintains a counter so we just need
> to examine it after each feature is added and when we hit the limit we
> simply stop reading from the data source. The result cache drives and
> subsequent presentation so that code wouldn't be touched. Check is
> something like:
>
>      /* check shape count */
>      if(lp->maxfeatures > 0 && lp->maxfeatures ==
> lp->resultcache->numresults) {
>        status = MS_DONE;
>        break;
>      }
>    } /* next shape */
>
> So my proposal would be to:
>
>  1) pull maxfeatures use out of the driver code, usually just a few lines
>  2) install the code to check the shape count in the query functions
> for consistent behavior
>  3) update msDrawLayer() similarly (code might already be doing this)
>  4) pull maxfeatures checks out of mapgml.c, they're redundant
>
> I consider this a bug, not a new feature so I'd propose this for
> 6.0.2. I can prepare a patch against branch-6-0 if that would help
> folks with the scope of the change. Note the OGC code that *sets*
> maxfeatures either based on a user set parameter or metadata would
> continue on "as is".
>
> Steve
>


More information about the mapserver-dev mailing list