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

Albrecht.Weiser at hzd.hessen.de Albrecht.Weiser at hzd.hessen.de
Mon Aug 11 05:24:11 EDT 2008


Hi Bart,
sorry for the delay, but i was absent last days. 
I think now i know, what the script does - it converts the SLD information into a mapscript file right? But then i anyhow use mapserver native styling. It's just turned from SLD to mapscript styling.  For a benchmark i was looking for a way to really use SLD without applying it in the url. 
 :o(  I think the community should find a way to integrate SLD into the mapfile in the future. It shouldn't be much trouble to implement this.
Best wishes
Albrecht

Albrecht Weiser, 
E6, GIS Center

Hessische Zentrale für Datenverarbeitung (HZD)
Mainzer Straße 29, 65185 Wiesbaden
Tel.:  0611 340-3113
Fax:  0611 340-5113
E-Mail: albrecht.weiser-at-hzd.hessen.de
 

> -----Ursprüngliche Nachricht-----
> Von: bartvde at osgis.nl [mailto:bartvde at osgis.nl] 
> Gesendet: Donnerstag, 7. August 2008 11:35
> An: Weiser, Albrecht (HZD)
> Cc: bartvde at osgis.nl; mapserver-users at lists.osgeo.org
> Betreff: Re: AW: [mapserver-users] How do i define my SLD 
> inside the mapfile?
> 
> 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: bartvde at osgis.nl [mailto:bartvde at osgis.nl]
> >> Gesendet: Donnerstag, 7. August 2008 09:52
> >> An: Weiser, Albrecht (HZD)
> >> Cc: mapserver-users at lists.osgeo.org
> >> 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
> >
> 
> 
> 
> 


More information about the Mapbender_users mailing list