[mapserver-users] UTFGrid and Cluster, feature distinction: 0, single or clustered

Alexandre Dubé adube at mapgears.com
Fri Jan 24 06:55:13 PST 2014


Hi,

   I just noticed that when using Clusters, only the non-clustered 
features (singles) are returned in the grid, so clicking on a cluster is 
like clicking on nothing.  That explains the behavior I get.

   I'll continue to look for a solution.

Alexandre


On 14-01-24 09:21 AM, Alexandre Dubé wrote:
> Hello MapServer community,
>
>   I'm using the new UTFGrid [1] feature in MapServer in addition with 
> Clusters [2] in an OpenLayers mapping application.  I'm trying to 
> implement the following feature: when the user clicks on a single 
> point, a popup gets shown (this works already) and when he/she clicks 
> on a clustered feature, then it must show different popup, without any 
> info about the features inside, nor the extent of the features, but 
> containing a simple link to invite the user to zoom in more.
>
>   So basically, I'm looking for a way for the returned utfgrid data to 
> know if the clicked element on the map is either: a single feature, a 
> clustered feature or nothing at all.  I thought I was close to a 
> solution, but it didn't work as I expected.  I thought of using the 
> FeatureCount inside the UTFDATA and then use the value returned to 
> determine the correct type:
>
>         UTFDATA '{"c":[Cluster:FeatureCount]}'
>
>   But the utf data only returns 2 values: 1 and 2.  It returns 1 when 
> it's a single feature, else 2 whenever it's a clustered feature 
> (regardless of the actual real feature count) and it also returns 2 
> when the user clicks on no feature at all.  I'm not sure if my 
> approach is a correct one, though...
>
>   Does someone have any idea how I could accomplish what I'm trying to 
> do ?  I'm using a trunk version of MapServer I haven't updated for a 
> couple months.
>
> Many thanks,
>
> Alexandre
>
> [1] http://mapserver.org/development/rfc/ms-rfc-93.html
> [2] http://mapserver.org/mapfile/cluster.html
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users




More information about the MapServer-users mailing list