Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

This is related to Retain ESRI symbology in Mapinfo TAB

As a workaround I am wondering if I can save all my ESRI symbology from the lyr files created using the script below to an ESRI style sheet and then convert that to a font set which can be opened in mapinfo/opengeo? enter image description here

The image above shows some of the [complex] symbology that we have in our ESRI mxd's that need to go into Mapinfo and/or Opengeo to be available via WMS.

Tests show that KML created from the lyr files handle the symbology better than tab but not every time.

Code so far...

# Author:


import arcpy, string, datetime, shutil, os
import arcpy.mapping as MAP

#Read input parameters from script tool
MXDList = string.split(arcpy.GetParameterAsText(0), ";")
ProjectPath = arcpy.GetParameterAsText(1)

#MXDList=r'P:\2012\183_TownPlanning_Symbology\Working\test.mxd'
#ProjectPath=r'P:\2012\183_TownPlanning_Symbology\Working'

count=0
#Loop through each MXD and print
#for MXDPath in MXDList:
#MXDFile=r'P:\2012\183_TownPlanning_Symbology\Working\Strategic_Plan_Ravenshoe_8.mxd'
count=count+1
print count
##try:
mxd=arcpy.mapping.MapDocument(MXDFile)
outPath = ProjectPath+'\\'+mxd.filePath[mxd.filePath.rfind('\\')+1:mxd.filePath.rfind('.')]
os.mkdir(outPath)
msd = outPath+'.msd'
dfList = arcpy.mapping.ListDataFrames(mxd)
for df in dfList:
#arcpy.mapping.ConvertToMSD(mxd, msd, df, "NORMAL", "NORMAL")
#arcpy.AddMessage(str(count)+'...' +str(outPath)+'...'+'\n')
    lyrList=arcpy.mapping.ListLayers(mxd, "", df)
    outPath = ProjectPath+'\\'+mxd.filePath[mxd.filePath.rfind('\\')+1:mxd.filePath.rfind('.')]+'\\'+str(df.name)
    os.mkdir(outPath)
    for lyrFile in lyrList:
        if lyrFile.isFeatureLayer == True:
            if lyrFile.visible == True:
                arcpy.AddMessage(str(lyrFile)+' is visible')
                print str(lyrFile)+' is visible...exporting dataset'
                outFileN=str(arcpy.ValidateTableName(lyrFile.longName[lyrFile.longName.rfind('\\')+1:]))
                try:
                    arcpy.FeatureClassToFeatureClass_conversion(lyrFile.dataSource, outPath, outFileN)
                    arcpy.SaveToLayerFile_management(lyrFile,outPath+'\\'+outFileN+'.lyr', "ABSOLUTE")
                    arcpy.LayerToKML_conversion(outPath+'\\'+outFileN+'.lyr', outPath+'\\'+outFileN+'.kmz')
                except:
                    print 'Exists...continuing'


        arcpy.AddMessage(str(lyrFile)+' is visible')
        print str(lyrFile)+' is not visible'
##except:
##    errorM=arcpy.GetMessages()
##    arcpy.AddMessage(str(count)+str(errorM)+'\n continuing...\n')
##    print errorM
##    #MAP.PrintMap(MXD, printer)
#Remove variable reference to file
del mxd, msd

BTW// I tried the msd route (change to .zip and open the xml) but it is very convoluted.

share|improve this question
add comment

2 Answers 2

I am not sure sure if the GeoCat bridge provides this exact functionality but its worth checking out.

http://geocat.net/bridge/

share|improve this answer
    
Thanks. This is quite an expensive option (thus currently not viable) and will only work for a WMS based solution...the primary need is conversion to tab/mapinfo symbology and wms is only if converting to mapinfo isn't practical. –  GeorgeC Jul 6 '12 at 10:34
add comment
up vote 1 down vote accepted

Basically this was not possible but figured out a roundabout way to get the result. See arcgis python script to tool issue for final result.

I am using Arc2Earth community edition to convert each lyr to sld. It is manual but quick.

Other questions to get to this stage are

Is it possible to convert an ESRI style sheet to a font set?

Retain ESRI symbology in Mapinfo TAB

and

Create a summary table of the symbology of all datasets in multiple mxd's

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.