[mapserver-commits] r11576 - in trunk/docs/en: images mapfile
svn at osgeo.org
svn at osgeo.org
Thu Apr 14 10:45:02 EDT 2011
Author: jmckenna
Date: 2011-04-14 07:45:02 -0700 (Thu, 14 Apr 2011)
New Revision: 11576
Added:
trunk/docs/en/images/cluster.png
Modified:
trunk/docs/en/mapfile/cluster.txt
Log:
enhance cluster doc
Added: trunk/docs/en/images/cluster.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/en/images/cluster.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/docs/en/mapfile/cluster.txt
===================================================================
--- trunk/docs/en/mapfile/cluster.txt 2011-04-14 14:18:31 UTC (rev 11575)
+++ trunk/docs/en/mapfile/cluster.txt 2011-04-14 14:45:02 UTC (rev 11576)
@@ -4,29 +4,23 @@
CLUSTER
*****************************************************************************
-The CLUSTER configuration option provides to combine multiple features from
-the layer into single (aggregated) features based on their relative positions.
-Supported only for POINT layers.
+.. index:: Cluster
-The clustered layer itself provides the following aggregated attributes:
+Description
+===========
-1) Cluster:FeatureCount - count of the features in the clustered shape
-2) Cluster:Group - The group value of the cluster (to which the group expression is evaluated)
+Since version 6.0, MapServer has the ability to combine multiple features from a
+point layer into single (aggregated) features based on their relative positions.
+Only *POINT* layers are supported. This feature was added through :ref:`rfc69`.
-These attributes (in addition to the attributes provided by the original data source) can be used to configure
-the labels of the features and can also be used in expressions.
-The ITEMS processing option can be used to specify a subset of the attributes from the original
-layer in the query operations according to the user's preference.
+Supported Layer Types
+=====================
-We can use simple aggregate functions (Min, Max, Sum, Count) to specify how the clustered attribute should be
-calculated from the original attributes. The aggregate function should be specified as a prefix separated by ':' in
-the attibute definition, like: [Max:itemname]. If we don't specify aggregate functions for the source
-layer attributes, then the actual value of the cluster attribute will be non-deterministic if the cluster contains
-multiple shapes with different values. The Count aggregate function in fact provides the same value as Cluster:FeatureCount.
-
-.. seealso::
- :ref:`rfc69`
+POINT
+Mapfile Parameters
+==================
+
MAXDISTANCE [double]
Specifies the distance of the search region (rectangle or ellipse) in pixel positions.
@@ -46,3 +40,153 @@
This expression is evaluated after the the feature negotiation is completed, therefore
the 'Cluster:FeatureCount' parameter can also be used, which provides the option
to filter the shapes having too many or to few neighbors within the search region.
+
+Mapfile Snippet
+===============
+
+.. code-block:: mapfile
+
+ LAYER
+ NAME "my-cluster"
+ TYPE POINT
+ ...
+ CLUSTER
+ MAXDISTANCE 20 # in pixels
+ REGION ellipse # can be rectangle or ellipse
+ GROUP (expression) # we can define an expression to create separate groups for each value
+ FILTER (expression) # we can define a logical expression to specify the grouping condition
+ END
+ LABELITEM "Cluster:FeatureCount"
+ CLASS
+ ...
+ LABEL
+ ...
+ END
+ END
+ ...
+ END
+
+Feature attributes
+==================
+
+The clustered layer itself provides the following aggregated attributes:
+
+1. Cluster:FeatureCount - count of the features in the clustered shape
+2. Cluster:Group - The group value of the cluster (to which the group expression is evaluated)
+
+These attributes (in addition to the attributes provided by the original data source) can be used to configure
+the labels of the features and can also be used in expressions.
+The ITEMS processing option can be used to specify a subset of the attributes from the original
+layer in the query operations according to the user's preference.
+
+We can use simple aggregate functions (Min, Max, Sum, Count) to specify how the clustered attribute should be
+calculated from the original attributes. The aggregate function should be specified as a prefix separated by ':' in
+the attibute definition, like: [Max:itemname]. If we don't specify aggregate functions for the source
+layer attributes, then the actual value of the cluster attribute will be non-deterministic if the cluster contains
+multiple shapes with different values. The Count aggregate function in fact provides the same value as Cluster:FeatureCount.
+
+Example: Clustering Railway Stations
+====================================
+
+The following example uses a point datasource, in this case in KML format, to display clusters of railway
+stations. Two classes are used: one to style and label the cluster, and one to style and label the single
+railway station.
+
+.. note::
+ Since we can't declare 2 labelitems, for the single railway class we use the *TEXT* parameter to label
+ the station.
+
+Mapfile Layer
+-------------
+
+.. code-block:: mapfile
+
+ ####################
+ # Lightrail Stations
+ ####################
+ SYMBOL
+ NAME "lightrail"
+ TYPE PIXMAP
+ IMAGE "../etc/lightrail.png"
+ END
+ LAYER
+ NAME "lightrail"
+ GROUP "default"
+ STATUS DEFAULT
+ TYPE POINT
+ CONNECTIONTYPE OGR
+ CONNECTION "lightrail-stations.kml"
+ DATA "lightrail-stations"
+ LABELITEM "Cluster:FeatureCount"
+ CLASSITEM "Cluster:FeatureCount"
+ ###########################
+ # Define the cluster object
+ ###########################
+ CLUSTER
+ MAXDISTANCE 50
+ REGION "ellipse"
+ END
+ ################################
+ # Class1: For the cluster symbol
+ ################################
+ CLASS
+ NAME "Clustered Lightrail Stations"
+ EXPRESSION ("[Cluster:FeatureCount]" != "1")
+ STYLE
+ SIZE 30
+ SYMBOL "citycircle"
+ COLOR 255 0 0
+ END
+ LABEL
+ FONT scb
+ TYPE TRUETYPE
+ SIZE 8
+ COLOR 255 255 255
+ ALIGN CENTER
+ PRIORITY 10
+ BUFFER 1
+ PARTIALS TRUE
+ POSITION cc
+ END
+ END
+ ################################
+ # Class2: For the single station
+ ################################
+ CLASS
+ NAME "Lightrail Stations"
+ EXPRESSION "1"
+ STYLE
+ SIZE 30
+ SYMBOL "lightrail"
+ END
+ TEXT "[Name]"
+ LABEL
+ FONT scb
+ TYPE TRUETYPE
+ SIZE 8
+ COLOR 0 0 0
+ OUTLINECOLOR 255 255 255
+ ALIGN CENTER
+ PRIORITY 9
+ BUFFER 1
+ PARTIALS FALSE
+ POSITION ur
+ END
+ END
+ # the following is used for a query
+ TOLERANCE 50
+ UNITS PIXELS
+ HEADER "../htdocs/templates/cluster_header.html"
+ FOOTER "../htdocs/templates/cluster_footer.html"
+ TEMPLATE "../htdocs/templates/cluster_query.html"
+ END
+
+Map Image
+---------
+
+.. image:: ../images/cluster.png
+
+
+
+
+
More information about the mapserver-commits
mailing list