[mapserver-users] GetMap vs GetFeatureinfo sort

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Tue Aug 28 02:33:54 PDT 2018


Hi,

From https://mapserver.org/mapfile/layer.html
"Inside a layer, only a single class will be used for the rendering of a feature. Each feature is tested against each class in the order in which they are defined in the mapfile. The first class that matches the its min/max scale constraints and its EXPRESSION check for the current feature will be used for rendering."

So in your example first geometry is rendered first with color 53 68 150 and the second one above it with color 188 34 115.

You wrote "I expect that the topmost feature returned in getfeatureinfo response 
correspond to the topmost feature drawn on map". If you think of the rendering process, of yourself painting with brushes, the topmost feature on the map is the one that is painted last. If I understand it ight you would like to get a reversed order for GetFeatureInfo.

A workaround could be to make a copy of the layer you show on the map but with reversed sorting order. This layer would be used only for GetFeatureInfo requests. According to WMS specification QUERY_LAYERS must be a subset of LAYERS but if I remember right Mapserver is not strict with that and you could capture the GFT request on server side and change the name of the QUERY_LAYER on-the-fly. If Mapserver is strict, or you use some other server that follows the standard, you must also manipulate the request a bit more and add this extra layer into &LAYERS=.  Of course if you can control the client side you can make it to alter the GetFeatureInfo instead.

Another option could be to read the feature info with WFS GetFeature instead of WMS GetFeatureInfo. I also guess that heavy users of Mapserver will recommend you to use some MapScript dialect.

Be aware that Mapserver does not offer a real WYSIWYG experience with GetFeatureInfo. You can get also something what you do not see because Mapserver does not filter the GFI result by rendering rules like min/maxscaledenominators. I also believe that even if you have classes only for expression values 1 and 4 in your mapfile the GetFeatureInfo finds everything that appears in the data. I am not sure about this, though.

-Jukka Rahkonen-




-----Alkuperäinen viesti-----
Lähettäjä: mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org] Puolesta Jörg Thomsen (WhereGroup)
Lähetetty: 28. elokuuta 2018 10:13
Vastaanottaja: mapserver-users at lists.osgeo.org
Aihe: Re: [mapserver-users] GetMap vs GetFeatureinfo sort

Hi,

hm, I would have expected the classes to be drawn in the same order as in the mapfile.

You could try to use the label-section with geomtransform 'labelpoint'
[1], perhaps mapserver there takes care of the mapfile order...

Another option would be to use grouped layers, I guess you found this
already:
https://gis.stackexchange.com/questions/71152/mapserver-layer-classes-display-order
-> 2nd answer

Jörg


[1] https://mapserver.org/mapfile/label.html
[2] https://mapserver.org/mapfile/geomtransform.html

Am 27.08.2018 um 20:37 schrieb pe_lord:
> Thanks. 
> 
> Here more informations.
> 
> I have 2 overlapping geometries. 
> 
> My class are based on a field ==> CLASSITEM "code_type" and appear in 
> my mapfile in this order.
> 
> CLASS
>     NAME "Blue CLASS"
>     EXPRESSION '1'
>     STYLE
>     SYMBOL "square"
>         SIZE 8
> 	COLOR 53 68 150
>     END
> END
> ...
> CLASS
>     NAME "Red Class"
>     EXPRESSION '4'
>     STYLE
>     SYMBOL "square"
>         SIZE 8
> 	COLOR 188 34 115
>     END
> END
> 
> My data is stored in this order into PG, with this structure (id,
> code_type,geom):
> id1,4,geom
> id2,1,geom
> 
> If I understand properly, my last geometrie (id2) is plotted on top of 
> other classes. This is making sense.
> 
> Otherwise, in the getfeatureinfo, the same order is kept, this a 
> non-sense according to my classes's order.
> 
> I would like to to present this data in a flipped order like, 
> according to my classes's logic:
> id2,1
> id1,4
> 
> 
> I expect that the topmost feature returned in getfeatureinfo response 
> correspond to the topmost feature drawn on map. I would like to have a 
> constant response, independently from my template format (gml, html,
> json...)
> 
> You will find an
> <http://osgeo-org.1560.x6.nabble.com/file/t378858/sl.png>
> 
> 
> Here what I tried without succes:
> - flip my mapfile's classes
> - sort my data based on my field (code_type). In this case, either I 
> have the getmap sorted in the right order, or the getfeatureinfo. Both 
> behaviors are impossible at the same time.
> 
> 
> 
> 
> 
> --
> Sent from: 
> http://osgeo-org.1560.x6.nabble.com/Mapserver-User-f4226646.html
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
> 


Viele Grüße,
Jörg Thomsen

-- 

******************************************************************
 FOSS Academy Sommerschule 2018
 Alles Wichtige zur Erstellung einer GDI in nur 5 Tagen erlernen!
 https://www.foss-academy.com/kompaktkurse
 *****************************************************************


Jörg Thomsen
WhereGroup GmbH & Co. KG
Gillweg 3
14193 Berlin
Germany

Fon: +49 (0)30 / 5130 278 74
Fax: +49 (0)30 / 89 09 53 21

joerg.thomsen at wheregroup.com
www.wheregroup.com
Amtsgericht Bonn, HRA 6788
-------------------------------
Komplementärin:
WhereGroup Verwaltungs GmbH
vertreten durch:
Olaf Knopp, Peter Stamm
-------------------------------
Folgen Sie der WhereGroup auf twitter: http://twitter.com/WhereGroup_com _______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list