arcpy.mapping stuff

2540
6
08-08-2011 09:14 AM
TedCronin
MVP Honored Contributor
should arcpy.mapping stuff go here, or in python?
Tags (2)
0 Kudos
6 Replies
TedCronin
MVP Honored Contributor
Is there a layer limit on how many layers can be listed or limitations with group layers, and or rasters?
0 Kudos
TedCronin
MVP Honored Contributor
running.

import arcpy
from arcpy import env as ENV
from arcpy import mapping as MAP

mxd = MAP.MapDocument (r"C:\beta\Reader_TestReplace.mxd")

for lyr in MAP.ListLayers (mxd):
    print lyr.name
    
del mxd
Is not working either in wing or py window, currently, or its taking a horribly long time, beyond 10 minutes to print out the lyr.name for layers, group layers and rasters.

this is win7.
0 Kudos
TedCronin
MVP Honored Contributor
So  this took easily 20 minutes to print, is that expected?

All County Parcels (Expand to View) 1:25,000

Draw Without Fill Color

Draw With Fill Color

Section Lines

Page Lines 1:80,000; PgNum: 1:25,000

Centerlines 1:60,000;  stname 1:30000

Major Roads

Highways

Book Boundaries

Cities

County Boundaries

PROP 8 - Agriculture

Ag 2011

Points - Agriculture 2011

Agriculture 2011 1/2 mi radius

Agriculture 2011 1 mi radius

Agriculture 2011 2 mi radius

Agriculture 2011 5 mi radius

Ag 2010

Points - Agriculture 2010

Agriculture 2010 1/2 mi radius

Agriculture 2010 1 mi radius

Agriculture 2010 2 mi radius

Agriculture 2010 5 mi radius

PROP 8 - Commercial

Commercial 2011

Points - Commercial 2011

Commercial 2011 1/2 mi radius

Commercial 2011 1 mi radius

Commercial 2011 2 mi radius

Commercial 2011 5 mi radius

Commercial 2010

Points - Commercial 2010

Commercial 2010 1/2 mi radius

Commercial 2010 1 mi radius

Commercial 2010 2 mi radius

Commercial 2010 5 mi radius

PROP 8 - Condos

Condos 2011

Points - Condos 2011

Condos 2011 1/2 mi radius

Condos 2011 1 mi radius

Condos 2011 2 mi radius

Condos 2011 5 mi radius

Condos 2010

Points - Condos 2010

Condos 2010 1/2 mi radius

Condos 2010 1 mi radius

Condos 2010 2 mi radius

Condos 2010 5 mi radius

PROP 8 - Manufactured Homes

Manufactured Homes 2011

Points - ManufacturedHomes 2011

ManufacturedHomes 2011 1/2 mi radius

ManufacturedHomes 2011 1 mi radius

ManufacturedHomes 2011 2 mi radius

ManufacturedHomes 2011 5 mi radius

Manufactured Homes 2010

Points - ManufacturedHomes 2010

ManufacturedHomes 2010 1/2 mi radius

ManufacturedHomes 2010 1 mi radius

ManufacturedHomes 2010 2 mi radius

ManufacturedHomes 2010 5 mi radius

PROP 8 - Parcels

Parcels 2011

Points - Parcels 2011

Parcels 2011 1/2 mi radius

Parcels 2011 1 mi radius

Parcels 2011 2 mi radius

Parcels 2011 5 mi radius

Parcels 2010

Points - Parcels 2010

Parcels 2010 1/2 mi radius

Parcels 2010 1 mi radius

Parcels 2010 2 mi radius

Parcels 2010 5 mi radius

PROP 8 - Residential

Residential 2011

Points - Residential 2011

Residential 2011 1/2 mi radius

Residential 2011 1 mi radius

Residential 2011 2 mi radius

Residential 2011 5 mi radius

Residential 2010

Points - Residential 2010

Residential 2010 1/2 mi radius

Residential 2010 1 mi radius

Residential 2010 2 mi radius

Residential 2010 5 mi radius

PROP 8 - Timeshares

Timeshares 2011

Points - Timeshares 2011

Timeshares 2011 1/2 mi radius

Timeshares 2011 1 mi radius

Timeshares 2011 2 mi radius

Timeshares 2011 5 mi radius

Timeshares 2010

Points - Timeshares 2010

Timeshares 2010 1/2 mi radius

Timeshares 2010 1 mi radius

Timeshares 2010 2 mi radius

Timeshares 2010 5 mi radius

PROP 8 - Vacant Land

Vacant Land 2011

Points - Vacant Land 2011

VacantLands 2011 1/2 mi radius

VacantLands 2011 1 mi radius

VacantLands 2011 2 mi radius

VacantLands 2011 5 mi radius

Vacant Land 2010

Points - Vacant Land 2010

VacantLand 2010 1/2 mi radius

VacantLands 2010 1 mi radius

VacantLands 2010 2 mi radius

VacantLands 2010 5 mi radius

Waterbodies
0 Kudos
MichaelGrossman
Esri Contributor
Hi. The Map Automation forum is the best place for questions specific to arcpy.mapping [http://forums.arcgis.com/forums/176-Map-Automation].  Or you can post to the Python forum if it is a cross cutting question involving all of arcpy.  But let me take a crack at what you've posted so far...

For the ListLayers problem, is the MXD slow to open in ArcMap, or only slow when accessed using arcpy.mapping outside of "CURRENT"?  If there are SDE based layers, we could have a real problem there.  Please reply with more info or log a bug with repro data attached.

For the printing issue, is it slow to print in ArcMap, or only when printing with arcpy.mapping?  If arcpy.mapping printing is slower than ArcMap printing, you may be using an excessively high value for the "image_quality" parameter by accident.

--Michael
0 Kudos
TedCronin
MVP Honored Contributor
ok, I did not see that forum, so I will post there after this post.  Thank you Mike.  i am hopefully going to be more involved with arcpy.mapping, this is only my second day since beta10 using arcpy.mapping, so bear with me.

The mxd points to SDE data, file GB locally, UNC over a network, and there are about 15 broken links.  opening the mxd, is pretty slow, so it may not be just arcpy.mapping.  Broken Links and UNC are probably the biggest culprits.  i am thinking the speed of the mxd with the broken links, is akin to what we experienced at 9.3 or 9.3.1 where there was a perf hit when you had broken links.

What I mean by printing is not actual printing of the mxd, but printing the list, so I can see the data, so see about replaceWorkspaces.  Is it possible to loop through layers and for the replaceWorkspacePath or the finadAndReplace...use the lyr.dataSource as the input, in place of the actual path, is that feasible?
0 Kudos
TedCronin
MVP Honored Contributor
Are there limits to saving out lyr files, where the name in the MXD has a semicolon or parenthesis in the name?  Meaning no special characters in the name is allowed to save out as layer files...
0 Kudos