Skip navigation
All Places >

python snippets

Log in to follow, share, and participate in this socialgroup.

Recent Activity

peyster
>>> import arcpy ... from arcpy import env ... env.workspace = "C:\temp" ... infc = "MDroads.shp" ... clipfc = "MC.shp" ... outfc = "MoCoClip.shp" ... arcpy.Clip_analysis(infc, clipfc, outfc) ... Runtime error Traceback (most recent call last): File "<string>", line 7, in <module> File "c:\program files… (Show more)
in python snippets
sourav@iastate.edu_ISUGISF
In a folder, I have 150+ raster files - some of them are pansharpened images, some are panchromatic images, and some are in other formats. Among them, 30+ pansharpened raster has the same naming format of date_ZoneName_pansharpened.tif  (e.g. 20180511_TX1_pansharpened.tif,  20180511_TX2_pansharpened.tif,  20180511_TX2_pansharpened.tif and etc.).… (Show more)
in python snippets
MatthewLeonard
ArcGIS custom toolbox which uses a python script, for updating a mass amount of field aliases at once, using a list of field names and corresponding aliases input by user. Let’s say you have an ArcGIS feature class or table with a bunch of cryptic, abbreviated field names, and you want to add aliases to make them easier to understand. Let’s say…
in python snippets
MTCGIS
Hello,    I'm trying to create a function that leverages the auto increment function which is provided as a field calculator example in ArcGIS Pro's Calculate Field Python examples. The auto increment function is pretty straight-forward however, I'm looking to increment based on the attributes of another field. I've attached an example of the… (Show more)
in python snippets
AChapman@jmt.com_jmt
I am trying to join multiple fields using an update cursor, I want to trim a filed to a specific length while the cursor iterates through and adds another field to the final string. I am working with a streets data set and will need to do this for streets that have no pre direction and streets that have a pre direction. I want to take only the… (Show more)
in python snippets
JerryGarcia
It appears I keep losing my database connection?  I am looping.  The first 6 or 20 or so operations execute fine, but then it appears I loose the database connection?  There is a pause, then a rapid fire of errors.  Once it loses a connection, it does not recover.   Any suggestions?  Thanks!   testSQLCreatorConnection =… (Show more)
in python snippets
vikasm
(As part of my learning python in ArcGIS) I used the simple clipping tool and then I paste the "Python snippet" (below) in the python window within ArCMap.    arcpy.Clip_analysis(in_features="RI_Sewers", clip_features="Providence", out_feature_class="C:/EsriTraining/PythEveryone10_1/PythonInArcGIS/RhodeIsland.gdb/Sewers", cluster_tolerance="")  … (Show more)
in python snippets
C.Molivadas_AlexGIS
How can I filter my DDP export based on features contained within the page extents?   I have a DDP project with 9000 pages, I use my building foortprint features to drive the index - I would like to determine which pages contain another certain feature like 'mailboxes'.  'mailboxes' don't occur on every page.  'mailboxes' are not the feature that… (Show more)
Stevenson_S15_uu_scobe
Hi folks, I've been stuck on this for ages. Hopefully someone might have some tips. I have some code to delete a .shp file.   arcpy.env.workspace = "C:/check" ws = arcpy.env.workspace in_data = "Folklore.shp" data_type = "" arcpy.env.overwriteOutput = True arcpy.Delete_management(in_data, data_type) arcpy.Delete_management('Folklore.shp')  … (Show more)
in python snippets
dogdaynoon
I am running ArcGIS Pro 2.0.0 on a windows 12 Server (not controlled by me). There is an automated python/arcpy script that runs every night that replaces some tables in a GDB. Until recently the script would run and use the credentials stored by ArcGIS Pro for startup to authorize license level. For some reason now the "Remember Me" option… (Show more)
in python snippets
Load more items