Hot answers tagged

6

I think the speed problem you are having is looping around each feature and using geoprocessing tools inside the loop. They are not designed for that. They expect to process the whole dataset at once. So restructure your script to avoid the loop and it should complete "within the time to drink a cup of coffee". The data is in my opinion so small that it ...


4

It sounds like what you are after is Background Geoprocessing, which was introduced at ArcGIS Desktop 10.0. However, I think ArcPy only became "Background Geoprocessing aware" with the introduction of Python Toolboxes at 10.1 - see Setting "Always run in foreground" within ArcPy code?


3

Try this: import arcpy from arcpy import env env.workspace = r"D:\desktop\Project" for mxdname in arcpy.ListFiles("*.mxd"): print mxdname mxd = arcpy.mapping.MapDocument(r"D:\desktop\Project\\" + mxdname) for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"): #fixed indent and replaced equality test. ...


2

I believe your second solution is way slower that the first one, since Clip has an inner Selection By Location plus other geometrical operations. So I suggest some improvements to your first algorithm: As per @artwork21 comment, merge the shapefiles if possible. e.g. they share the same schema. This procedure removes an extra loop over the shapefiles, ...


2

You seem to have misinterpreted a suggestion offered in a comment. Instead of: inputOne = "C:\Users\DELL\AppData\Local\Temp\tmpA378\tmpA379.gdb\PerpendicularLine" inPointElevations = inputOne print os.path.dirname(inputOne) pathAfterJoin = os.path.join(inputOne) arcpy.TopoToRaster_3d(inPointElevations,"D:\\Temp\\topo1234") try using: inputOne = ...


2

row.getPart(0) is necessarily returning the first geometry in the row, so it won't be an iterable. Thus your code becomes: import arcpy # Set up the Environment arcpy.env.overwriteOutput = True arcpy.env.workspace = r"C:\temp" fc = r"C:\Utemp\cities.shp" fields = ['SHAPE@XY'] output = open(r"C:\temp\cities.txt", 'w') COFilePath = r"C:\temp\cities.csv" ...


1

I found out how it works: shpList = container.split(";") for singleShp in shpList: arcpy.Buffer_analysis(singleShp, "F:\test\" + singleShp, "100 Meters")


1

I think the only way to do this is through ArcObjects. The IMap.AnnotationEngine property can be used to get or set the label engine. As Arcpy is a subset of ArcObjects, this particular property has not been implemented at the moment. I can't see Esri adding it any time soon, as Arcpy is supposed to be a reduced set of features and they are very reluctant ...


1

Some things to think about. If your example is any indicator, you are going to have over 5 million records when you are finished. Neither shapefiles or personal geodatabases will handle that very well, so you should use either a file geodatabase or SDE. Processing 48 million records won't be quick, especially when it involves a spatial selection. Perhaps ...



Only top voted, non community-wiki answers of a minimum length are eligible