<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.5pt;
        font-family:Consolas;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:Consolas;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Tamas<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>OK, it’s good to know that I should be able to make it work.  At the moment I have a layer with around 5000 features, each feature having an attribute showing the groups that it belongs to – something like the following:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>                                <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Feature 1             “group1|group3|group4|group7”<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Feature2              “group1|group2|group5|group8”<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Feature5000       “group2|group4|group7|group9”<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>If I use a mapfile that incorporates a cluster class (very similar to the example in the documentation) and set the layer up with no filter as follows then I get the expected cluster map which incorporates all 5000 features:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>$map = ms_newMapobj(&quot;/var/www/vhosts/mysite/httpdocs/test.map&quot;);</span><span style='font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>$layer1=$map-&gt;getLayerByName(&quot;test1&quot;);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>..<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>..<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>$image=$map-&gt;draw();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>$image_url=$image-&gt;saveWebImage();<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>If I try to incorporate a filter into this layer in the form “/group4/” then I get no output at all. I tried various methods to apply the filter, e.g.:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>$layer1-&gt;set(“filteritem”, “Groups”);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>$layer1-&gt;setFilter(“/group4/”);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Or (as suggested by Daniel)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>$layer1-&gt;cluster-&gt;setFilter(“/group4/”);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I also tried using “group4” instead of “/group4/” because there is some reference in 6.0 documentation to the regex syntax changing, but this did not help.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>On the other hand if reorganise the mapfile so the layer has no cluster class, then filtering works fine, so only around 400 features from group4 are displayed when I use: <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>$layer1-&gt;set(“filteritem”, “Groups”);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>$layer1-&gt;setFilter(“/group4/”);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I have been experimenting with this for the last two days but have not found a way to obtain a clustered output that is filtered (or a filtered output that is clustered, I don’t care which). Can you confirm if you think there should be a way to make this work (and even better, suggest some other syntax I could try)?<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Chris<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Tamas Szekeres [mailto:szekerest@gmail.com] <br><b>Sent:</b> 21 June 2011 13:32<br><b>To:</b> Chris Green<br><b>Cc:</b> Jeff McKenna; mapserver-users@lists.osgeo.org<br><b>Subject:</b> Re: [mapserver-users] PHP-Mapscript - clusterObj ?<o:p></o:p></span></p></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>Hi Chris,<br><br>The cluster-&gt;filter setting accepts mapserver expressions which should evaluate to a boolean value. This is something similar to the layer-&gt;filter option, provided the option to exclude certain features to be used in the clustering algoritm. I'm not sure about you exact requirement, so I cannot decide whether it provides a solution or not.<br><br>Best regards,<br><br>Tamas<br><br><br><o:p></o:p></p><div><p class=MsoNormal>2011/6/21 Chris Green &lt;<a href="mailto:chris.green@ibstv.co.uk">chris.green@ibstv.co.uk</a>&gt;<o:p></o:p></p><p class=MsoNormal>Hi Jeff<br><br>I'd be happy to go down that path and document examples along the way as you suggest, but I have a feeling that there may be something about the way that the cluster algorithm works that makes it incompatible with the regex filtering that I would also like to do. If that turns out to be the case then I will need to restructure the way that I access my data, in effect to filter it myself before presenting it to the layer to be displayed with clustering. This will be quite a task - before I decide which way to go on this is there someone out there who can confirm (at least in principle) that it should be possible to simultaneously filter and cluster the data in a layer if I can only find the right mapscript syntax to make it happen?<o:p></o:p></p><div><p class=MsoNormal><br><br><br>Chris<br><br>-----Original Message-----<br>From: <a href="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-bounces@lists.osgeo.org</a> [mailto:<a href="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-bounces@lists.osgeo.org</a>] On Behalf Of Jeff McKenna<o:p></o:p></p></div><div><div><p class=MsoNormal>Sent: 20 June 2011 22:30<br>To: <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>Subject: Re: [mapserver-users] PHP-Mapscript - clusterObj ?<br><br>Hi Chris,<br><br>Let's plan this for our next phase of attack. &nbsp;As you travel down this<br>cluster-php-mapscript path, document your full examples in the MapServer<br>wiki:<br><br>- login to the wiki (use your osgeo ID, which you can create at<br><a href="http://www.osgeo.org/osgeo_userid" target="_blank">http://www.osgeo.org/osgeo_userid</a>)<br>- goto <a href="http://trac.osgeo.org/mapserver/wiki/PHPMapScript" target="_blank">http://trac.osgeo.org/mapserver/wiki/PHPMapScript</a><br>- create a new page there, in the &quot;Examples&quot; section<br>- add as many examples as you wish for the Cluster object<br>- be sure to add &quot;this was added by [yourname] [email]&quot;<br>- when you are satisfied with that, email the mapserver-dev mailing list<br>- then I will change the CLUSTER example in<br><a href="http://www.mapserver.org/mapfile/cluster.html#php-mapscript-usage" target="_blank">http://www.mapserver.org/mapfile/cluster.html#php-mapscript-usage</a> to<br>point to your page<br><br>And you get all the glory! :)<br><br>thanks!<br><br>-jeff<br><br><br><br>--<br>Jeff McKenna<br>MapServer Consulting and Training Services<br><a href="http://www.gatewaygeomatics.com/" target="_blank">http://www.gatewaygeomatics.com/</a><br><br><br><br><br>On 11-06-20 4:47 PM, Chris Green wrote:<br>&gt; Hi Jeff<br>&gt;<br>&gt; Thanks. Fame at last...!<br>&gt;<br>&gt; However I am still struggling with the combination of clustering and regex filtering. What I can say for sure is that clustering works if no regex filter is applied, and filtering works (using a regex filter in the form &quot;/target/&quot;) with no clustering. But I have so far failed to make the two work together.<br>&gt;<br>&gt; This is where I am currently (which does not work for me):<br>&gt;<br>&gt; $map = ms_newMapobj(&quot;/var/www/vhosts/mysite/httpdocs/test.map&quot;);<br>&gt; $layer1=$map-&gt;getLayerByName(&quot;test1&quot;);<br>&gt; $layer1-&gt;cluster;<br>&gt; $layer1-&gt;set(&quot;filteritem&quot;, &quot;attribute 1&quot;);<br>&gt; $layer1-&gt;setFilter(&quot;/target/&quot;);<br>&gt;<br>&gt; Any ideas?<br>&gt;<br>&gt;<br>&gt; Chris<br>&gt;<br>&gt;<br>&gt; -----Original Message-----<br>&gt; From: <a href="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-bounces@lists.osgeo.org</a> [mailto:<a href="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-bounces@lists.osgeo.org</a>] On Behalf Of Jeff McKenna<br>&gt; Sent: 20 June 2011 20:31<br>&gt; To: <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>&gt; Subject: Re: [mapserver-users] PHP-Mapscript - clusterObj ?<br>&gt;<br>&gt; Hi Chris,<br>&gt;<br>&gt; I've added your PHP MapScript example to the mapfile's CLUSTER page:<br>&gt; <a href="http://www.mapserver.org/mapfile/cluster.html" target="_blank">http://www.mapserver.org/mapfile/cluster.html</a><br>&gt;<br>&gt; Thanks!<br>&gt;<br>&gt; -jeff<br>&gt;<br>&gt;<br>&gt;<br>_______________________________________________<br>mapserver-users mailing list<br><a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br><br><br>_______________________________________________<br>mapserver-users mailing list<br><a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><o:p></o:p></p></div></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div></body></html>