[mapserver-users] some questions regarding getFeatureInfo, SLD, PostGIS

Julien Cigar jcigar at ulb.ac.be
Fri Sep 21 03:24:43 PDT 2012


Hello,

I'm using Mapserver 6.0.1 with the following PostGIS layer: 
http://pastie.org/private/84042k84vmljbontls5xvq

The user has the possibility to select quite a lot of filters, which 
implies that the SQL query should, in theory ,be generated dynamically. 
As this is not possible with Mapserver (run-time substitution with HTTP 
parameters and VALIDATION ... END isn't powerful enough is my case), I'm 
dynamically generating an SLD 
(http://pastie.org/private/p66ml3uvqwcnphuuvera) to filter items and it 
works very well.

Some questions:

- Why does Mapserver doesn't have a very lightweight template language 
(or something similar) to dynamically build a string following given 
parameters? It could be really useful to avoid unnecessary JOIN, etc. 
For example something like: 
http://pastie.org/private/bojm3pi1dwrv18m2tvq (this is just an example, 
but the idea is there)

- I noticed in the PostgreSQL logs that sometimes Mapserver adds an 
additional condition to the WHERE clause when SLD is used. For example 
with the following <ogc:Filter> in my SLD:
#########################################
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>basis_of_record_id</ogc:PropertyName>
<ogc:Literal>1</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
#########################################

Mapserver adds an additional "and (( ("basis_of_record_id"= 1) ))":

(...) AS q where geom && GeomFromText('POLYGON((-3.6860351557368 
-9.81732918571448,-3.6860351557368 9.81732918571447,47.6860351496117 
9.81732918571447,47.6860351496117 -9.81732918571448,-3.6860351557368 
-9.81732918571448))',4326) and (( ("basis_of_record_id"= 1) ))

which is not bad as less rows have to be post-processed by the SLD engine.

However, as soon as I add an additional <ogc:or> (or <ogc:and>) as:
#########################################
<ogc:or>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>basis_of_record_id</ogc:PropertyName>
<ogc:Literal>1</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>basis_of_record_id</ogc:PropertyName>
<ogc:Literal>2</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:or>
#########################################

Mapserver doesn't add this additional AND/OR clause (and (( 
("basis_of_record_id"= 1) OR ("basis_of_record_id" = 2) )) in this 
case).. Why ?

- Is it normal that my SLD is totally ignored when I'm using 
REQUEST=GetFeatureInfo? Is the SLD only processed with REQUEST=GetMap? 
If this is the case, what's the typical alternative way of doing it? 
Should I go through WFS .. ?

In advance, thank you for your answers :)
Julien

-- 
No trees were killed in the creation of this message.
However, many electrons were terribly inconvenienced.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: jcigar.vcf
Type: text/x-vcard
Size: 292 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120921/349b1c33/attachment.vcf>


More information about the mapserver-users mailing list