Pre-reqs: arcmap, mapserver (with PHP mapscript), webserver (with PHP support)
1. Load the layers and set the colourings and any filters you want into the mxd.
2. Download Amein! from sourceforge. Follow the instructions to add into arcmap
4. Once loaded, run amein! and fill out the dialog boxes (some are required)
5. Save and open the folder containing the generated map file
6. Open a text editor and create SLD.php. Paste the following ,
// Load mapscript
// Create map object
$oMap = ms_newMapObj("C:\file\slip.map");
// Call the SLD output
$SLD = $oMap->generateSLD();
7. Save SLD.php to a web accessible directory. Browse to that URL in your browser. (eg. http://localhost/sld.php)
8. Some text should be written to the screen in an unformatted manner. Right click inside the browser window and click â€˜View Sourceâ€™
9. Tada, the SLD. Select all and save contents to file, SLD.xml will do.
10. Open SLD.xml and check contents. While generateSLD does work quite well, on occasion it can struggle with things like Literal filter attributes. Have a quick glean over it to make sure all the tags are closed and it validates.
11. Add &SLD=http://path.to/your/sld.xml to your Mapserver query string and check the results.
Who said things always had to be done the hard way? These steps are particularly useful for further splitting the SLD into separate layers for use in Geoserver (dont get me started on WMS-SLD for gs ).
Hope this helps some people out there. Amein! is particularly good for converting a layer with a stack of class definitions. Ive done one with 45 classâ€™es for one layer and it outputted the map file correctly, with the classification still in tact. Very nifty util, enjoy.