Tuesday, 31 March 2015

arcgis server - How to correctly uncompress and re-compress an msd file using 7zip from command line


I am trying to uncompress and recompress both the msd and sd file so as to tweak some things I want. In fact I want to get inside the layers folder and for each layer.xml file to string replace the the name of the dbconnection. My goal is to create, with a bat file, 5 sd files genarated from an original sd file - for 5 users that are connected to the same oracle xe database, with the same password. It looks ambitious but It works. I tried channging the db names by hand, by getting inside the sd and the the msd packages, using 7zip following a method described by @ericchiasson here. In the same article @jpmc26 states that you can recompress and uncompress the sd, but you have to follow specific compression properties. @jpmc26 says:



By the way, you can recompress an sd file. You have to use the right compression options. Options that work for me are Format: 7z, Word Size: 16, Solid Block size: Non-solid. I also set Dictionary Size to 64KB, but I don't think that matters. All other options were left to their defaults. (I made some educated guesses based on the fact 7-zip reports the compression method as "LZMA:16" for an sd file.) – jpmc26 Jun 18 at



I followed his instruction and used 7z from command line like this: 7za a -t7z -m0=lzma -md=64k -ms=off %MAP_NAME_MXD%.7z However these properties work for compressing the sd file. Inside the .sd there is one compressed file which is of .msd type. I try compressing it with the same configutaration, after having uncompressing that so as to tweak the .xml files inside of it.


When I try to publish my generated sd it is published correctly but it fails to start. I tried replaceying with the original msd the generated msd inside of my newly generated sd, and both service publish and start worked. This made me thinking that the method of compressing the msd package is the problematic one.


Can anyone tell me what are the correct compression options for the msd files ? An alternative would be to avoid uncompression and recompression by injected in some way the tweaked layer xml files inside of the msd. But I dont know if that is possible




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...