[Qgis-developer] Re: MXD

mayeulk mayeul.kauffmann at free.fr
Fri Mar 25 09:37:43 EDT 2011


Hi Barry and Stephan,
Any news about extracting data from mxd ?

Building on your "strings -e l" I am able to extract list of shapefiles from
mxd but I wonder how to expand this to the other layer types in an mxd, of
if by now there are OS tools to do this.

My current, limited code is:
grep -A 2 "Shapefile Feature Class" foo.mxd  | sed -e ':a;N;$!ba;s/\n/\t/g' 
-e 's/\t--\t/\n/g' | sed -e '/^Shapefile Feature Class\tShape\t/d' -e
's/^Shapefile Feature Class\t//g' -e 's/\tShapefile Feature
Class\tShape\t/\t/g' > foo_shapefiles.csv

Mayeul

On Thu, Jan 27, 2011 at 1:56 PM, Stephan Holl
<[hidden email]> wrote:

> I would love to read more about Barries reverse engeneerings of the
> 'obfuscated' format.

 All I've discovered at the moment is that if you dump it using
"strings -e l foo.mxd" on a Linux box you can actually see the file
names of shapefiles and geotiffs - they're stored as UTF-16 strings.
But being able to locate where in the whole mush of strings that whizz
past so you could automatically strip them out is another problem.

 If I actually had this problem on a one-off, say someone gave me a
MXD with two layers and the accompanying shapefiles, I'd probably just
do it manually - start Qgis, load two layers. With a hundred layers
I'd probably get the filenames and make a Qgis project file
programmatically. But given that extracting anything other than the
layer file names and ordering (styling, for example) is just about
impossible I'd probably do it from the filenames rather than the MXD
itself. But anyway, for me the break-even point for automating this is
about 20 layers, and that might only happen once in my lifetime...

Barry 

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/MXD-tp5965419p6207713.html
Sent from the qgis-developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list