Hi Albrecht,

you can run the script like:

php -d safe_mode=off /data/geoservices/scripts/applysldurl.php
/data/OGC_UMN_services/kerngisnat_utre.map http://145.50.148.45/nu.sld
~bart/kgnat_svn2/services/kerngisnat_utre.map.new

Make sure the paths to your input and output MAP file are absolute, and
read the SLD from a webserver.

Btw, Mapserver matches the NamedLayers from the SLD to the NAME of the
LAYER in the MAP file, so they have to be the same for it to work
properly.

This will generate CLASSes for your layers in the MAP file.

Best regards,
Bart

> Hi Bart,
> what a luck that there's a workaround. Unluckily i'm not a php crack :o/
> Could you please tell in a few catchwords how to apply the script?
> Thanks
> Albrecht
>
>> -----Ursprüngliche Nachricht-----
>> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Gesendet: Donnerstag, 7. August 2008 09:52
>> An: Weiser, Albrecht (HZD)
>> Cc: [email protected]
>> Betreff: Re: [mapserver-users] How do i define my SLD inside
>> the mapfile?
>>
>> No you can't use an SLD directly in a WMS server MAP file.
>>
>> What I normally do is apply the SLD to the MAP file using a simple PHP
>> script:
>>
>> #!/bin/sh
>> sudo -u apache php -f $0 $*; exit $?
>>
>> <?php
>>
>> if ($argc != 4) {
>>   echo "Usage: applysldurl.php <input MAP file> <SLD url> <output MAP
>> file>\n";
>>   echo "\n";
>>   echo "Applies the SLD url to the layers in the MAP file\n";
>>   echo "\n";
>>   exit(1);
>> }
>>
>> $oMap = ms_newMapObj($argv[1]);
>> $oMap->applySLDURL($argv[2]);
>> $oMap->save($argv[3]);
>>
>> echo "Output saved to $argv[3]\n";
>>
>> ?>
>>
>> Best regards,
>> Bart
>


_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to