feature filtering by size

Stephen Lime steve.lime at dnr.state.mn.us
Mon Aug 16 12:00:39 EDT 1999


There's one way to do that now. It takes a quite different approach. There
is a keyword called "MAXFEATURES" that allows you to define the maximum
number of features shown for a given layer. So if set to 50 only the first 50
shapes that are in bounds are actually drawn. Now, this only makes sense
if you're data is somehow sorted. There is a routine I wrote in the shapelib
directory called sortshp that will sort a shapefile in ascending or decending
order based on a numeric field. So with your lakes data if you sort based on
area in descending order, and draw say only 25 at a time you might get the
desired effect. There are benefits to this approach over a filter:

  - it's faster (there is no expensive filtering)
  - assuming your data isn't uniformly distributed (spatially or by size) you
    always get something from that layer displaying

This technique works well with cities sorted by population and other 
non-continuous datasets. There are benefits to filters as well. That's what 
classes are for, but regular expressions aren't well suited to numerical 
expressions like area > 10,000. Could count digits though so it is possible
using classes.

Hope this helps.

Steve

Stephen Lime
Internet Applications Analyst
MIS Bureau - MN DNR

(651) 297-2937
steve.lime at dnr.state.mn.us

>>> "Brent Fraser" <bfraser at digitalscience.com> 08/16 10:19 AM >>>
Steve,

  Have you considered adding functionality to Mapserver for
filtering features by size?

I'm using the drainage layer from DCW data to render lakes.
Unfortunately they don't have an attribute to classify them
into small, medium, large.  They do have area and perimeter
attribute, so I guess I could make multiple layer entries in
the map file.

  Any thoughts?

Brent

GeoAnalytic Inc.
1150 , 633 - 6th Avenue SW Calgary, AB T2P 2Y5
Tel:  (403)213-2700 Fax:  (403)213-2707
bfraser at geoanalytic.com 
www.geoanalytic.com 





More information about the mapserver-users mailing list