Skip navigation
All Places >

python snippets

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

Recent Activity

Entsika_Liesl
Hi All,    I am new to python, and have been using data driven pages to export multiple maps. However, I would like to change the way I'm naming my maps. Currently it is the custom name + the page name that is linked to the data driven pages.See script below:   mxd = arcpy.mapping.MapDocument("CURRENT") ... df =… (Show more)
behClevest
I am trying to create a Python Toolbox and I need to load some chekboxes to a parameter (param2) after selecting a value in previous parameter (param1). As you can see I have name of states in param1 and need to load a code like this after changing on param1 inFeature = parameters[0].valueAsText slectedCounty = parameters[1].valueAsText counties =… (Show more)
in python snippets
NHVRGIS
Hi All,   I am trying to write unit tests that will ensure all SHAPE related fields within an MXD are hidden. However, even if the SHAPE field visibility is unchecked within the ArcMAP -> Layer Properties -> Fields -> "Choose which fields will be visible" GUI, it seems impossible to read/access this state in ArcPY.   The following will all… (Show more)
in python snippets
behClevest
Can you please take a look at this snippet and let me know why I am not able to properly pass the Where Clause ('"[NAME_1]" = Ohio') in SearchCursor?     import arcpy from arcpy import env def unique_values(table , field): with arcpy.da.SearchCursor(table, [field], '"[NAME_1]" = Ohio') as cursor: return sorted({row[0] for row in cursor}) uniques… (Show more)
in python snippets
behClevest
I am using following to copy selected feature from a Shapefile to a Dataset in a File Geodatabase   As you can see I tried to create layer from shapefile by doing arcpy.MakeFeatureLayer_management(inFeature, 'lyr') and then select the attribute like    arcpy.SelectLayerByAttribute_management('lyr', "NEW_SELECTION", '"NAME_1" =… (Show more)
in python snippets
Archaeojp
PROBLEM: I have a python script that replaces an existing feature class within a GDB with new data using the line below (part of a longer script): arcpy.FeatureClassToFeatureClass_conversion(URD, tempGDB, "URD", urd_selection_expression)URD is a sql query layer, tempGDB is an established geodatabase, "URD" is a feature class that is deleted in an… (Show more)
in python snippets
behClevest
Can you please take a look at this demo and let me know why I am not able to create new feature class from a shapefile  based on selecting by attribute and saving the new future in a Geodatabase?   The file is adding to the GDB but it is empty on attributes and geometry     # Import arcpy module import arcpy # Local variables: Dataset =… (Show more)
in python snippets
acervantest
Hi, I was investigating on my own, but I did not get a solution. I need to move points in a massive way to specific coordinates, I found a phyton code that makes it perfect in ArcMap, but the problem is that the points are a feature service, and in ArcMap it is not so easy to edit, and the service is very heavy for a local copy, then, I thought… (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
tpylaw
I'm creating a script where I'm trying to select all the null values based on a specific field. The feature is joined with another feature, thus altering the title of fields to be FeatureName_FieldName. I want to keep these titles as I will be exporting the table and if I set qualified field names to False, the fields won't be able to be properly… (Show more)
in python snippets
Load more items