Thanks for the suggestion! I hadn't thought of that.  My plan B is/was to have 
1 cluster layer without getFeatureInfo disabled, which is turned off at a 
certain scale, where a regular layer with getFeatureInfo takes over. However, I 
think that the user experience gets quite worsened doing that.

As I read your suggestion, I tried to have one layer with only getFeatureInfo 
turned on, and getFeatureInfo turned off for the cluster layer. The problem 
seems to be that it puts too much strain on data loading, even though the 
source table contains only around 20,000 rows. I crashed QGIS several times 
testing this.

It's too bad. It doesn't seem like it's possible to get getFeatureInfo to work 
in a reliable way for cluster layers. One interesting observation is that the 
label always is correct, and the reason for that seems to be that it doesn't 
use PROCESSING "ITEMS=…".  But without PROCESSING "ITEMS=…" I don't get access 
to other attributes, it seems.

Erik

Fra: Bob Basques <bbasq...@sharedgeo.org<mailto:bbasq...@sharedgeo.org>>
Sendt: torsdag 20. februar 2025 16:49
Til: Guldberg, Erik <erik.guldb...@ra.no<mailto:erik.guldb...@ra.no>>
Kopi: mapserver-users@lists.osgeo.org<mailto:mapserver-users@lists.osgeo.org>
Emne: Re: [MapServer-users] Wrong and inconsistent GetFeatureInfo result for 
CLUSTER layer

This might not be an approach that will get you exactly what you are looking 
for, but have you thought about using two different layers, one for queries and 
one for display, or maybe you are looking for some sort of cluster based 
results back?  I don't have a lot of experience with CLUSTERs myself.

bobb



On Fri, Feb 14, 2025 at 7:51 AM Guldberg, Erik via MapServer-users 
<mapserver-users@lists.osgeo.org<mailto:mapserver-users@lists.osgeo.org>> wrote:
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

Reply via email to