[mapserver-users] Clustering based on a classified column

Frank Broniewski brfr at metrico.lu
Tue Mar 20 11:08:54 EDT 2012


Hy,

I just had the same idea as you, Stephan, to cluster features based on 
attribute values. I think your expression fails because "1" != 1, so 
basically you can't do maths (<>) with the Cluster:FeatureCount, just 
String comparisons.
Actually I don't understand the reason why that is so. Imo 
ClusterFeatureCount should return a number, not a String.

Frank


Am 20.10.2011 10:36, schrieb Stephan Holl:
> Hello Tamas,
>
> thanks for you reply.
>
> Tamas Szekeres<szekerest at gmail.com>, [20111019 - 19:04:22]
>
>> I'm not sure exactly what you would like to achieve.
>
> Sorry, let my show an example to make it clear:
> I have a classified layer based on the following CLASSES
>
> CLASS
>    NAME "bar"
>    EXPRESSION ('[typ]'='bar')
>    STYLE
>      SYMBOL "bar"
>     END
> END
>
> CLASS
>    NAME "foo"
>    EXPRESSION ('[typ]'='foo')
>    STYLE
>      SYMBOL "foo"
>     END
> END
>
> ... more CLASSes
>
> As you see, they are classified by the values of the column [typ].
>
> What I want to achieve is adding a label (with the
> Cluster:FeatureCount as text) if the different classes have more
> identical attributes within the MAXDISTANCE.
>
> What I currently do is adding another CLASS:
> LABELITEM "Cluster:FeatureCount"
> CLASS
>    NAME "Clustered foo"
>    EXPRESSION ("[Cluster:FeatureCount]">  "1"&&  '[typ]'='foo')
>    STYLE
>      SYMBOL "foo"
>     END
>    STYLE
>      SIZE 20
>      OFFSET 15 15
>      SYMBOL "circle"
>      COLOR 255 0 0
>    END
>    LABEL
>      FONT freesans
>      TYPE TRUETYPE
>      SIZE 10
>      COLOR 255 255 255
>      OFFSET 15 15
>      ALIGN CENTER
>      PRIORITY 10
>      BUFFER 1
>      PARTIALS TRUE
>      POSITION cc
>    END
> END
>
> CLASS
>    NAME "foo"
>    EXPRESSION ('[typ]'='foo')
>    STYLE
>      SYMBOL "foo"
>     END
> END
>
> ... more CLASSes
>
> The problem of the above is, that I have to include the SYMBOL 'foo'
> also in the clustered CLASS, because the normal SYMBOL does not show up
> (because it is not there since it is clustered now...).
>
> But: I have to do that for all classes I have currently (about 25).
>
> My thinking was about a dynamic classification and clustering based on
> the attributes of a specific column ([typ]), but I cannot make it work.
>
> Does this make more sense to you now?
>
>> The GROUP setting
>> specifies which features may belong to the same cluster. This setting
>> can be an expression (including the feature attributes) which
>> evaluates to a string value. Features with different group string
>> value are not used within the same cluster.
>>
>> The FILTER setting can also be an expression (including the feature
>> attributes or the aggregated attributes) which evaluates to a boolean
>> value. This boolean determines whether the particular shapes should
>> be filtered out or not in the clustering process.
>
> Thanks for your clarification, this is helpful for my understanding.
>
>> You can continue to use the CLASSITEM setting or class EXPRESSION
>> (including the aggregated attributes, like Cluster:FeatureCount in
>> the expressions) to control which class is used to display a
>> particular clustered shape.
>>
>> What do you mean by validation in the GROUP or FILTER expressions?
>
> Does my above example more sense to you?
>
> Best
>
> 	Stephan
>
>>
>> 2011/10/19 Stephan Holl<stephan.holl at intevation.de>
>>
>>> Dear mapservers,
>>>
>>> I am playing arround with the CLUSTER-directive and I am going fine.
>>>
>>> Though there are some questions left I cannot answer by myself and
>>> the documentation.
>>>
>>> Is it possible to cluster a POINT layer based on a specific
>>> attribute columns? THis column is the  basis of the classification
>>> of the layer.
>>>
>>> What I want to achive is adding a label to each CLASS if the
>>> Cluster:FeatureCount is>  1.
>>>
>>> The docs do not make it clear for me if CLUSTER:GROUP or
>>> CLUSTER:FILTER is the correct stuff. Neither of them work during
>>> tests.
>>>
>>> Could someone tell me if this could be done with the CLUSTERing?
>>>
>>> And the bonus-question: if this is possible, are validation-pattern
>>> taken into account within GROUP or FILTER?
>>>
>>> Looking forward to your suggestions.
>>>
>>> TIA
>>>
>>> Best regards
>>>
>>>         Stephan
>>>
>>> --
>>> Stephan Holl<stephan.holl at intevation.de>  | Tel.: +49 (0)541-33 508
>>> 3663 Intevation GmbH, Neuer Graben 17, 49074 OS  |  AG Osnabrück -
>>> HR B 18998 Geschäftsführer:  Frank Koormann, Bernhard Reiter, Dr.
>>> Jan-Oliver Wagner
>>>
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>
>>>
>
>
>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


-- 
Frank BRONIEWSKI

METRICO s.à r.l.
géomètres
technologies d'information géographique
rue des Romains 36
L-5433 NIEDERDONVEN

tél.: +352 26 74 94 - 28
fax.: +352 26 74 94 99
http://www.metrico.lu


More information about the mapserver-users mailing list