Tag Info

Hot answers tagged

4

I am not sure if the following will not do the same thing as dissolve, but if I'm correct, it should not. You can use a SearchCursor() to loop through the polygons, get each polygon's geometry, add these as parts on a new polygon geometry object, and use an InsertCursor() to insert this new record. sc = arcpy.SearchCursor("c:/temp/fishnet2.shp") ic = ...


3

Environments aren't propagated from process to process, so changing extent in one won't affect the other at all.


3

Based on your variable, you just need to make sure variables and strings are not confused field_1="!field_name1!" field_2="!field_name2!" arcpy.CalculateField_management("Layer", field_0, field_1 + " / " + field_2, "PYTHON_9.3") note that if you have the strings as variables without the "!", it is nicer to use format() field_1="field_name1" ...


2

No it is not possible to add "Folder Connections" using Arcpy. Folder Connections are stored in the ArcCatalog.gx file, which is typically located at c:\Users\*username*\AppData\Roaming\ESRI\*Desktopverion*\ArcCatalog\ArcCatalog.gx This is a binary file, so forget about editing it. The only thing you could possibly do is to create the Folder ...


2

1) You create a SearchCursor object which is assigned to the variable cursor: # place all the rows from the feature class into a search cursor cursor = arcpy.SearchCursor("IndCases") But then you try to access this using the variable cur, which doesn't exist: for row in cur: Try using for row in cursor instead. 2) See the arcpy.da.SearchCursor help ...


2

As from the comment, you could loop on each feature then run the selection by location on a feature layer. There are different types of loops for this purpose 1) based on a selection by attribute for each FID in a feature layer or 2) directly based on the geometry in a cursor. Here is the code with a cursor, which is more straightforward IMHO. You get the ...


2

Consider using Dissolve. This will write the output to a new feature class but it may be more efficient. In my experience dissolve operations have taken less time than merge. Run a benchmark to determine which is faster. There may be some issue with merge/dissolve wrt to performance and dissolving circular arcs (such as results of buffering points, ...


2

You are missing the wrapping exclamation marks, try this: arcpy.CalculateField_management("Layer", field_0, '!' + field_1 + '!/!' + field_2 + '!', "PYTHON_9.3")


2

You have embedded the string variable within a string so python sees it as a string. I would suggest you make you code something like: field_0="field_name0" calcString = "!field_name1! / !field_name2!" arcpy.CalculateField_management("Layer", field_0, calcString', "PYTHON_9.3")


1

Have a search in help for the subject "Performance tips for joining data" it offers advice on improving join performance. Your code does not indicate you have added an attribute index which can often improve performance.


1

there is a flipline tool, though it doesn't seem to allow queries on a feature. it may be that you can provide the tool with a feature layer based on the selected attributes. EDIT: As @JasonT mentioned, the flip tool should honor selections, so perhaps use make feature layer with a SQL clause on the features that should be flipped and pass that layer to ...


1

Got it figured out! Thanks to @Aaron's comments I was able to find a conversion: dMeanRatio2 = numpy.asscalar(dMeanRatio)


1

The only types of layers you can add to an mxd with arcpy.mapping are map layers (layers in an mxd), and layer files (.lyr). A feature layer (in-memory layer) you create using the Make Feature Layer tool is not valid. In addition, Make Feature Layer doesn't accept topologies as input (a topology is a dataset, not a feature class). You can export a ...



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