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

You can try this, it requires saving your layers out to a lyr file on disk before adding it to the second map. In map one, run this code: arcpy.SaveToLayerFile_management("yourlayerinmap", r'youroutputlocation') In map two, run this code: mxd = arcpy.mapping.MapDocument('CURRENT') df = arcpy.mapping.ListDataFrames(mxd)[0] layer = ...


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

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")


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

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 ...


1

You should just install the 32 bit version of Anaconda.


1

You're using a 64 bit version of Python in your Anaconda installation and ArcMap's Python is 32 bit. You'll need to install some 64 bit ArcGIS build (either 64 bit Background Geoprocessing or ArcGIS for Server) and point to that instead, or install a 32 bit Anaconda instance instead and try again. See the downloads page and get the 32 bit installer.


1

The answer which I found yesterday, and PolyGeo referenced in his comment above, was to use the full path to the sde instead of the relative path. I still don't understand why the IDLE GUI/shell can't use the relative path when the ArcMap python window can.


1

Thanks for all the great ideas. Unfortunately I was stuck using arcGIS as getting admin privileges at my workplace is near impossible. Basically what I ended up doing was appending 100 files at a time rather than 1 at a time. This reduced the runtime to just over 24 hours.


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 ...



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