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?
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...
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.
Answer
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
Converting ArcGIS style (symbology) to font for MapInfo/OpenGeo?
Retain ESRI symbology in Mapinfo TAB
and
Creating summary table of symbology of all datasets in multiple MXDs?
No comments:
Post a Comment