@ JamalGood to know it did not crash the map for you...I tested it on my laptop, which has Windows 8 and ArcGIS for home use license. Perhaps the freezing issue was related to running on Windows 8 but who knows. I'll try it on my work computer tomorrow (Windows 7) to see if I can reproduce the issue. Should be good to go on any mxd and you can leave as many layers on as you want using the "keep layers on" parameter. I did not explain in my prior post, but I also have set up a wildcard option for the other layers (the ones used to turn on and off during the export to JPG). This may be useful for future use.@ Ganesh,The tool I wrote is an ArcGIS 10.1 tool. This would be backwards compatible with 10.0 (but you would have to redo the set up to a script tool as a 10.0 version tool for the GUI). To answer your question, no this script is not compatible with ArcGIS 9.3 because it uses the arcpy module (and more importantly the mapping class for this tool); 9.3 uses arcgisscripting.
Perfect�?�Perfect�?�Perfect! It worked like a charm. I�??m very thankful to your help and massive effort.The ArcGIS 10.1 didn�??t crash
Thanks for your reply...!!! Is there any other way to run this tool in my version..????Hope some one will help..!!!!
Hi ganesh,It worked fine in ArcGIS 10.1. There should be some issues related to your versionCheersJamal
Hi,I wanted to use your tool in my project but when i'm trying to run it's end up with the below error. i missed something..???I'm using Arcmap 9.3.1..Executing: Script2 Start Time: Sun May 19 12:00:47 2013 Running script Script2... <type 'exceptions.SyntaxError'>: invalid syntax (<string>, line 26) Failed to execute (Script2). End Time: Sun May 19 12:00:47 2013 (Elapsed Time: 0.00 seconds) Can you please guide me step by step.. because i'm very new to python programming...i wanted to learn it by doing...please help me..!!Thanks..
Executing: Script2 Start Time: Sun May 19 12:00:47 2013 Running script Script2... <type 'exceptions.SyntaxError'>: invalid syntax (<string>, line 26) Failed to execute (Script2). End Time: Sun May 19 12:00:47 2013 (Elapsed Time: 0.00 seconds)
Hi Jamal,I was able to alter the tool to do what you wanted, however, every time I run it ArcMap freezes after it is complete. It properly exports all the jpgs but then I have to force close ArcMap afterwards. I do not really know what is going on with that, I could not figure out what is causing the issue. I played around with deleting the mxd object, refreshing the active view and a few others but same result every time, I don't know why. See if you can reproduce this issue. Here is the tool, hopefully it will work without freezing ArcMap for you.If anyone else tests this out (v 10.1 tool) and can figure out why it might be crashing ArcMap I would love to know!
Ok, I made it into a script tool for you. You can open this up inside the current map and run it from the toolbox like any other tool. It takes one parameter, which will be the output folder for all your .jpg files. I tested this on the UntitledII.mxd and it worked fine.
Yes, this can be done with Python. I did a simple test where I just had 12 building layers and roads were my lines and turned off all buildings layers. I numbered them like Building1, Building2, etc. In your case you may want to give the layers a more descriptive name. I used a wildcard to search for all layers that start with 'Buildings*' and looped through to turn only that layer on (lines layer is always on). I am assuming your properties you want to show are set up as a label? import arcpy, os from arcpy import mapping as m arcpy.env.overwriteOutput = True mapPath = r'C:\Users\GIS\Desktop\maptest.mxd' outpath = r'C:\Users\GIS\Desktop\Exports' mxd = m.MapDocument(mapPath) df = m.ListDataFrames(mxd)[0] # Loop through layers for lyr in m.ListLayers(mxd, 'Buildings*'): lyr.visible = True lyr.showLabels = True # I'm assuming this is where you have the properties? jpg = os.path.join(outpath, lyr.name + '.jpg') m.ExportToJPEG(mxd, jpg) print 'Exported %s' %jpg lyr.visible = False del mxd You could get a lot more fancy with this, but this should get you started in the right direction. Since you are at 10.1, you have more control over the legend and you can turn on/off the auto-add feature to add the current layer inside the loop to the legend.Here is a shot of my map and the folder with all the output jpgs.[ATTACH=CONFIG]24423[/ATTACH][ATTACH=CONFIG]24424[/ATTACH]
import arcpy, os from arcpy import mapping as m arcpy.env.overwriteOutput = True mapPath = r'C:\Users\GIS\Desktop\maptest.mxd' outpath = r'C:\Users\GIS\Desktop\Exports' mxd = m.MapDocument(mapPath) df = m.ListDataFrames(mxd)[0] # Loop through layers for lyr in m.ListLayers(mxd, 'Buildings*'): lyr.visible = True lyr.showLabels = True # I'm assuming this is where you have the properties? jpg = os.path.join(outpath, lyr.name + '.jpg') m.ExportToJPEG(mxd, jpg) print 'Exported %s' %jpg lyr.visible = False del mxd
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.