[mapserver-users] How do i define my SLD inside the mapfile?

bartvde at osgis.nl bartvde at osgis.nl
Thu Aug 7 03:51:49 EDT 2008


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

> Hi mapserver list,
> i need to style my map project with SLD. But because using a special
> client which doesn't support a whole request with
> &SLD=http://placeofmysld/..... i have to put the reference to the SLD
> inside my mapfile. I was researching a way, but the only thing i found
> was a method to do it in the METADATA element when binding a remote wms.
> But thats no way - to create a separate wms and bind it in another one
> because that slows down the map creation drastic. Is there another way
> to define my SLD inside the map file?
> Thanks
> Albrecht
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>




More information about the mapserver-users mailing list