Tamas
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:
Feature 1 “group1|group3|group4|group7”
Feature2 “group1|group2|group5|group8”
.
.
.
Feature5000 “group2|group4|group7|group9”
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:
$map = ms_newMapobj("/var/www/vhosts/mysite/httpdocs/test.map");
$layer1=$map->getLayerByName("test1");
..
..
$image=$map->draw();
$image_url=$image->saveWebImage();
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.:
$layer1->set(“filteritem”, “Groups”);
$layer1->setFilter(“/group4/”);
Or (as suggested by Daniel)
$layer1->cluster->setFilter(“/group4/”);
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.
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:
$layer1->set(“filteritem”, “Groups”);
$layer1->setFilter(“/group4/”);
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)?
Chris
From: Tamas Szekeres [mailto:[email protected]]
Sent: 21 June 2011 13:32
To: Chris Green
Cc: Jeff McKenna; [email protected]
Subject: Re: [mapserver-users] PHP-Mapscript - clusterObj ?
Hi Chris,
The cluster->filter setting accepts mapserver expressions which should evaluate
to a boolean value. This is something similar to the layer->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.
Best regards,
Tamas
2011/6/21 Chris Green <[email protected]>
Hi Jeff
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?
Chris
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jeff McKenna
Sent: 20 June 2011 22:30
To: [email protected]
Subject: Re: [mapserver-users] PHP-Mapscript - clusterObj ?
Hi Chris,
Let's plan this for our next phase of attack. As you travel down this
cluster-php-mapscript path, document your full examples in the MapServer
wiki:
- login to the wiki (use your osgeo ID, which you can create at
http://www.osgeo.org/osgeo_userid)
- goto http://trac.osgeo.org/mapserver/wiki/PHPMapScript
- create a new page there, in the "Examples" section
- add as many examples as you wish for the Cluster object
- be sure to add "this was added by [yourname] [email]"
- when you are satisfied with that, email the mapserver-dev mailing list
- then I will change the CLUSTER example in
http://www.mapserver.org/mapfile/cluster.html#php-mapscript-usage to
point to your page
And you get all the glory! :)
thanks!
-jeff
--
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/
On 11-06-20 4:47 PM, Chris Green wrote:
> Hi Jeff
>
> Thanks. Fame at last...!
>
> 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
> "/target/") with no clustering. But I have so far failed to make the two work
> together.
>
> This is where I am currently (which does not work for me):
>
> $map = ms_newMapobj("/var/www/vhosts/mysite/httpdocs/test.map");
> $layer1=$map->getLayerByName("test1");
> $layer1->cluster;
> $layer1->set("filteritem", "attribute 1");
> $layer1->setFilter("/target/");
>
> Any ideas?
>
>
> Chris
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Jeff McKenna
> Sent: 20 June 2011 20:31
> To: [email protected]
> Subject: Re: [mapserver-users] PHP-Mapscript - clusterObj ?
>
> Hi Chris,
>
> I've added your PHP MapScript example to the mapfile's CLUSTER page:
> http://www.mapserver.org/mapfile/cluster.html
>
> Thanks!
>
> -jeff
>
>
>
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users