Hi Erik,

Are you able to confirm the issue still exists on newer versions of MapServer 
(8.4 or 8.2.2)?
There was a fix related to CLUSTER and PostGIS added to the newer versions, see 
https://github.com/MapServer/MapServer/pull/7111.

Seth

--
web:https://geographika.net & https://mapserverstudio.net
mastodon: @geographika@mastodon.social

On Tue, Feb 18, 2025, at 10:16 AM, Guldberg, Erik via MapServer-users wrote:
> It's interesting to note that, if I set a label, like the name of the object 
> ("tittel"), it's always correct. It's only the getFeatureInfo that is wrong.
>  
> Also, I've tried to create a cluster layer from another dataset, where the 
> main different is, I believe, that the projection is different, and I don't 
> have the same problem there. Using the same cluster settings.
>  
> *Fra:* MapServer-users <mapserver-users-boun...@lists.osgeo.org> *På vegne av 
> *Guldberg, Erik via MapServer-users
> *Sendt:* fredag 14. februar 2025 14:51
> *Til:* mapserver-users@lists.osgeo.org
> *Emne:* [MapServer-users] Wrong and inconsistent GetFeatureInfo result for 
> CLUSTER layer
>  
> Hi,
> I have a WMS service, https://kart.ra.no/wms/brukerminner, where I have 
> problems getting correct getFeatureInfo results from a layer with CLUSTER 
> content.
>  
> It contains the cluster layer and a regular point layer for the same data. 
> The regular point layer is shown at 1:50 000.
>  
> For single objects in both the cluster layer, I want to be able to use 
> getFeatureInfo. This works, but the problem is that the results most of the 
> time are wrong, and that they change for time to time, likely due to change 
> in zoom level. For the regular point layer, the result is always correct. 
> I've also created a test cluster layer without the scale limit, and that also 
> gives the correct result if I zoom in enough.
>  
> All the symbols are placed correctly in the map, for all layers. I've used 
> the database, and also this OGC API service (that uses the same data source 
> as the WMS) as a reference: https://api.ra.no/brukerminner
>  
> I'm using MapServer version 7.6.4.
>  
> Some example queries, using QGIS.
> Wrong result. The object I get in the getfeatureinfo is 64 km away from where 
> I clicked.
> https://kart.ra.no/wms/brukerminner?language=nor&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&BBOX=760392.02671199827454984%2C8263040.88853696268051863%2C1033357.36004533339291811%2C8407916.1385369636118412&CRS=EPSG%3A3857&WIDTH=1984&HEIGHT=1053&LAYERS=Brukerminner&STYLES=&FORMAT=image%2Fpng&QUERY_LAYERS=Brukerminner&INFO_FORMAT=text%2Fhtml&I=1069&J=616&FEATURE_COUNT=10
>  
> Zoomed in a bit more gives another, wrong result. This is 8.7 km away from 
> where I clicked:
> https://kart.ra.no/wms/brukerminner?language=nor&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&BBOX=871972.11004533257801086%2C8307721.07603696547448635%2C940213.44337866583373398%2C8343939.88853696547448635&CRS=EPSG%3A3857&WIDTH=1984&HEIGHT=1053&LAYERS=Brukerminner&STYLES=&FORMAT=image%2Fpng&QUERY_LAYERS=Brukerminner&INFO_FORMAT=text%2Fhtml&I=1022&J=627&FEATURE_COUNT=10
>  
> This is the Test-layer, how it looks now. I've tried different variations of 
> PROCESSING settings.
>  
> LAYER
>                 NAME "TEST"
>                 DEBUG 5
>                 TYPE POINT
>                 STATUS ON
>                 TEMPLATE "../templates/brukerminner.html"
>                 HEADER "../templates/header.html"
>                 FOOTER "../templates/footer.html"
>     TOLERANCEUNITS pixels
>                 TOLERANCE 25
>     # MINSCALEDENOM 50000
>                 METADATA
>                                "wms_enable_request" "*"
>         "wms_include_items" "tittel"
>  
>         "wms_title" "TEST"
>                                "wms_feature_info_mime_type" "text/html"
>  
> END                     
> PROJECTION
>                 "init=epsg:4326"
> END
>  
> EXTENT -19.76 54.57 45.57 82.67  #4326
> PROCESSING "CLOSE_CONNECTION=DEFER"
>  
> CONNECTIONTYPE POSTGIS
> CONNECTION "host=host  dbname=db user=user password=password port=5432"
> DATA "geom from xx.xx using unique id using srid=4326"
>  
>  
> LABELITEM "Cluster_FeatureCount"
>  
> # PROCESSING "CLUSTER_ALGORITHM=SIMPLE"
> PROCESSING "CLUSTER_GET_ALL_SHAPES=ON"
> PROCESSING 
> "ITEMS=tittel,beskrivelse,fylke,kommune,opprettet,endret,opprettet_av,linkkulturminnesok,gpsposisjon"
> # PROCESSING "CLUSTER_KEEP_LOCATIONS=ON"
> CLUSTER
> MAXDISTANCE 50
>  
> REGION "ellipse"
> END
>  
> CLASS
>                 NAME "Brukerminne"
>     EXPRESSION ("[Cluster_FeatureCount]" = "1")
>                 STYLE
>                                SYMBOL "brukerminne"
>         COLOR 200 0 0
>                                SIZE 27
>         OFFSET 0 -13.5
>                 END
> END
> END              
>  
>  
> Anyone with ideas on what's wrong?
>  
>  
> Thanks,
> Erik
>  
> _______________________________________________
> MapServer-users mailing list
> MapServer-users@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
> 
_______________________________________________
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to