10 Easy steps for converting mxd to map & sld

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 ,

< ?php
// Load mapscript
// Create map object
$oMap = ms_newMapObj("C:\file\slip.map");
// Call the SLD output
$SLD = $oMap->generateSLD();
// Output
echo $SLD;

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.

Latest ESRI goodies

Dave Macguire has released some new information on ESRI’s upcoming Image Server ..

On Monday during the Plenary we will introduce a new type of Image Server. It takes a different approach to serving up large (TB) quantities of Images. The data is held in the raw file format (no need to pre-process, or load into a DBMS). The Server builds an index so that the files can be treated as a continuous image map. Services can be authored to process the images on the fly as they are served up to desktop or web clients. For example, you could create a service that radiometrically corrects the images, georeferences them, orthorectifies them, resamples them and then serves them up in a browser or in ArcMap. The neat thing is that this can be done using Landsat 15m data for the entire globe, on the fly, with sub-second response. The same approach works for aerial photography and other image data sets.

Interesting and good news, but hardly surprising. Unfortunately i cannot invisage their IS serving out anything other than SID’s or TIFF’s which still serves as their bottle neck. The lack of any mention of “streaming” these on the fly, stiched up image maps has me worried. Still, seems a lot better than the solution of just storing a stack of SID’s in SDE. Of course, feel free to prove me wrong :)

It oozes keyhole technology, but even that isnt new. Speaking of which, tomorrow i will add an article outlining how to add dynamic, live WMS output to your google earth. It performs extremely well, minus some niggling issues.

ps. The 9.2 release definately seems to be raising the bar across all ESRI apps. Good work


I wont bother giving my background guys, as you can read up on that on the contact page. I have one aim setting this bugger up, and that is for venting, code snippets and assistance wherever I can. My experience at DLI gives me a broad overview of a lot of new GIS technology across the board .. I’m not an ESRI / Intergraph shop, I’m not a MS / GS shop and im certainly not going to preach how OGC standardisation is going to cure world hunger. No, its time to get back to basics.

The lack of any independant source of GIS info or help, free from “external” influences infuriates me. While seeking support at the product’s site obviously makes sense, seeing posts such as “What application should i go for? Arcims or Mapserver?” posted on the respective sites more often than not attracts incredibly biased information and sometimes outright wrong. It’s one thing I’ve noticed about GIS applications, word of mouth is key.

I guarantee that if you ask 8/10 people who run existing web GIS applications why they chose that product over any other, they’ll either

  • have no idea any other products exist
  • have been told how much “better” X product is from Y or
  • have contact with some other organisation that has said product installed and equally has no idea what other products are available

Its pretty much a given that there is a almost drought of information comparing web GIS products. Almost everything is subjective to opinion, then those facts just turn into chinese whispers. Well, hopefully in the coming months i will have some results benchmarking all web GIS applications i could get my little hands on. The preliminary results are very interesting to say the least ;) So stay tuned.