[Chameleon] Dynamic SLD - variable passing problem

Yewondwossen Assefa assefa at dmsolutions.ca
Mon Sep 27 09:57:40 EDT 2004


I checked the problem more in details last week with files sent by Tim 
and here is the answer I sent back  :

"I just checked your files and here is why your situation won't work : 
variable substitutions (%variable%) work only with some string 
parameters such as DATA, FILTER, CONNECTION and EXPRESSIONs.  It won't 
do the replacements on your metadata value. The limitation is probably 
due to the fact that you do not want mapserver to parse the whole map 
file to do substitutions since it is time consuming.

  Not sure how you can sove the problem but one suggestion is that you 
could structure it so that a script of yours would open a the map file, 
replace the string %study_id% with appropritae value, then save this map 
temporarly and use it for the request (As you mentionned, when the value 
is hardoced in the map file like this :  "wms_sld_url" 
"http://localhost/msapps/world_testdata/tests/sld_tests/sld_php_genrated.php?study_id=2"
tt seems to work fine. "


Later,


Paul Spencer wrote:
> Timothy,
> 
> I don't see anything wrong with this approach in general.  Do you mean 
> that the value of %study_id% is not being put into the map file?  Or 
> that the sld url is not used when requesting the wms layer?
> 
> If the value of %study_id% is not being correctly replaced, I think that 
> has to do with how mapscript processes the map file ... variable 
> replacement in mapfiles is not something that I know a lot about and 
> specifically I don't know if it will work the way you seem to be trying 
> it.  My approach to this would be to write a widget that would fix up 
> the metadata on selected layers ...
> 
> If the wms_sld_url metadata is not being passed along with the WMS 
> request, then that is a different problem (perhaps Assefa can comment on 
> this?)
> 
> Cheers,
> 
> Paul
> 
> 
> 
> Pascoe,Tim [Burlington] wrote:
> 
>>         I’m working on setting up a dynamically generated SLD, in 
>> order to provide user-defined filtering for my application. The SLD is 
>> being applied to a virtual OGR layer, from my database. I can do it 
>> with a raw request to mapserver by including the SLD= tag, and a path 
>> to my php scrip which returns the SLD document. However, when I 
>> include the SLD in the metadata for the layer, it seems as if the 
>> variable is not passed into the SLD script from the CGI forms. The 
>> source for the layer is an OGR/VRT being served as a WMS.
>>
>>
>> My layer is set up as follows:
>>
>>   LAYER
>>
>>     NAME "CABINPoints"
>>
>>     GROUP "Sample Points"
>>
>>     STATUS ON
>>
>>     TYPE RASTER
>>
>>     TOLERANCE 5
>>
>>     TOLERANCEUNITS PIXELS
>>
>>     TEMPLATE "tt.html"
>>
>>     CONNECTIONTYPE WMS
>>
>>     CONNECTION 
>> "http://localhost/scripts/mapserv.exe?map=C:/Documents%20and%20Settings/TimP/My%20Documents/CABIN/Maps/map/pointswms.map" 
>>
>>
>>     METADATA
>>
>>           "wms_onlineresource" "http://localhost/scripts/mapserv.exe?"
>>
>>           "wms_sld_url" 
>> "http://localhost/CABIN/Maps/map/study_sld_script.php?study_id=%study_id%" 
>>
>>
>>         "wms_title" "CABIN Points test layer"
>>
>>         "wms_abstract" "Test Access to CABIN SQL-Server Database on 
>> ECBURAS1"
>>
>>         "wms_srs" "EPSG:42304"
>>
>>         "wms_name" "CABINPoints"  # Eventually change this to the name 
>> of the Project being mapped
>>
>>         "wms_formatlist" "image/png,image/gif,image/jpeg,image/wbmp"
>>
>>         "wms_format" "image/png"
>>
>>         "selected" "0"
>>
>>         "wms_server_version" "1.1.1"
>>
>>         "wms_title" "Site Location"
>>
>>     END
>>
>>     PROJECTION
>>
>>       "init=epsg:4326"
>>
>>     END
>>
>>     DUMP TRUE
>>
>>   END
>>
>> Thanks…
>>
>> Timothy Pascoe
>>
>> Environment Canada / Environnement Canada
>> Canada Centre for Inland Waters / Centre Canadien des Eaux Intérieures
>> 867 Lakeshore Road / 867, chemin Lakeshore
>> Burlington, Ontario / Burlington (Ontario)
>>
>> L7R 4A6
>>
>> Tel/Tél: (905) 336-6239
>> Fax/Téléc: (905) 336-4699
>> E-mail/C. élec: ___tim.pascoe at ec.gc.ca_ <mailto:tim.pascoe at ec.gc.ca>
>> Government of Canada/Gouvernement du Canada
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Chameleon mailing list
>> Chameleon at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/chameleon
> 
> 


-- 
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst

Email: assefa at dmsolutions.ca
http://www.dmsolutions.ca/

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------




More information about the Chameleon mailing list