As far as I can make out there are no built in mapserver parameters that match your countPoints
pseudo parameter so unfortunately there is no way of doing what you want in a plain mapfile. It seems to me you have two options available:
Use MapScript: you can use
getNumFeatures()
on a layer to retrieve the number of features and programatically adjust the classes and styling based on the result.Embed the feature count information in the source data, either explicitly with an attribute field containing the feature count or implicitly by altering the attributes present if
MAXFEATURES > 10000
. With the latter option you can check whether the attribute is present in a mapfile expression.
Going down the route of embedding the feature count information in the source data means you need to generate the data for each request as you have moved the logic from the mapfile to the code that creates the data. This means either having the data come from a database with SQL calling a procedure encapsulating the logic, or use a layer CONNECTIONTYPE
with a remote data source which you control (e.g. an OGR CONNECTIONTYPE
can consume a GeoJSON resource over HTTP generated by a script).