Skip navigation
All Places >

python snippets

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

Recent Activity

donaldsonk
Hi I'm looking for a python script to populate an ID field in ACRGIS 10.2 with a sequential number that resets when the value of site field changes. e.g. Site      ID SIte A   0001 Site A   0002 SIte A   0003 Site A   0004 SIte A   0005 Site B   0001 SIte B   0002 Site B   0003 Site C   0001 SIte C   0002 ...           ..... I've… (Show more)
in python snippets
behClevest
  I need to add all features within a dataset called MainSt in a file geodatabase which is stored at following directory C:/Temp/Roads.gdb to current map. using following code I am able to add them one by one but can you please let me know how I can loop and add them dynamically     mxd = arcpy.mapping.MapDocument("CURRENT")     df =… (Show more)
in python snippets
behClevest
I am using this code to add a feature from GeoDatabase dataset to an open MXD file   import arcpy mxd = arcpy.mapping.MapDocument(r"C:\Temp\Streets.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] targetGroupLayer = arcpy.mapping.ListLayers(mxd, "Main", df)[0] addLayer = arcpy.mapping.Layer(r"C:\Data\NetMap.gdb\Streets\OneWay")… (Show more)
in python snippets
behClevest
I am able to run Geometric Network Trace by using following ArcPy script but I also need to add Trace result into the map. Can you please let me know how I can add the result(graphic/geometry) to the map. import arcpy arcpy.env.workspace = r"E:/Utility/Sample/Montgomery.gdb" # Local variables: G_N =… (Show more)
in python snippets
behClevest
Can you please let me know how we can set current map to Full Extent using ArcPy? import arcpy import arcpy.mapping # Set the Map to be Full Extent mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.Set-To-Full_Extentlike what the is doing on main toolbar in the ArcMap?
in python snippets
jfrey07259
I am trying to create a simple code that will select features in a shapefile based on the query {anything within the ATTRIBUTE field that starts with the letter 'P'}. Here the problematic line:   arcpy.SelectLayerByAttribute_management("NJ_Wetlands", "NEW_SELECTION", """"ATTRIBUTE" LIKE P%""")   I know I could do this simply in the toolbox GUI,… (Show more)
in python snippets
behClevest
I am trying to run this ArcPy example from ESRI TraceGeometricNetwork example 2    # Import arcpy module import arcpy # Local variables: Water_Net = "C:/GeometricNetworks/Montgomery.gdb/Water/Water_Net" Flags = "C:/GeometricNetworks/Montgomery.gdb/Water/Flags" Water_Net_2 = "Water_Net" # Process: Trace Geometric Network… (Show more)
in python snippets
behClevest
I am running Kivy and Python properly when it is only Kivy as import kivy kivy.require('1.0.6') from kivy.app import App from kivy.uix.label import Labelbut when I add ArcGIS Python library called ArcPy like below import arcpy import kivy kivy.require('1.0.6') from kivy.app import App from kivy.uix.label import LabelI am getting following… (Show more)
in python snippets
behClevest
I have a Transformer feature in a Geometric Network which has a field called `PhaseDesig` and it has five types of unique attributes [0, 1, 2,4,7] like this image   I used this code to generate Geometric Network   arcpy.CreateGeometricNetwork_management(Electric, "Electric_Net", "Power SIMPLE_JUNCTION YES;\ Fuses SIMPLE_JUNCTION NO; \… (Show more)
in python snippets
Load more items