Calculating (with Python) a 2nd field based on a 1st field in 10.2
I am attempting to write a script that takes one field and sorts it from largest to smallest. I then want to add another field next to the sorted field in order to indicate a sequential order of the...
View ArticleHow to spatially sort line features???
Hi all, I wrote a script to calculate angle bisectors of adjacent lines. I pasted my code here. This code worked fine if the line segments are in right order. However, if the features are not in a...
View ArticlePython to open shp files and populate metadata across directories
Hi, I am looking for some input regarding Python scripting. (Win 7 x64, Python 2.7, Arc 10.1) Our office outputs numerous shp files from other software that only creates .shp, .dbf, .shx files. The...
View ArticleProject Trasformation for a list of shp don't work
hello guys. I wrote this script that should read a list of shp file from a folder and then define the spatial and then the project. How do I create db before, and in one of these I'm going to put the...
View ArticleReplicate tool within Python Toolbox with some changes to behaviour
Hi, I have two tools within a single Python Toolbox. Currently the second tool just references the first ('class Tool2(Tool):')and therefore is a direct copy. How do I implement some changes to the...
View ArticleTrying to run a model called from a script fails
I have a model that runs fine in model builder. It will not run as a script exported from model builder, apparently because it contains a composite address locator. As a workaround, I have a python...
View ArticleDetermine if valid query returns records
What's the most elegant way to determine if a valid SQL Query (Attribute Query or Definition Query) returns no records? I wrote this little function to just take a layer on disk, apply a definition...
View ArticleValidate Query?
Has anyone ever noticed that the layer.definitionQuery property will just blindly assign anything you give to it, even if its an invalid query? Example: This is an invalid query. The FIELDNAME should...
View Articledissappearing layers from arcpy.mapping.MapDocument() Layer set.
I am working in version 10.1. I have several layers stored in a file GDB\Feature Dataset. All layers are added to an MXD and organized into Group Layers. In ArcMap midway through a session Layers that...
View ArticlePrevent Python script tool from automatically filling output boxes
I am creating a script tool as part of a Python Toolbox (.pyt) that performs some fairly basic tasks. The tool takes a single input file and creates three output rasters (see image). The problem I am...
View ArticleProject shapefile returns blank output
Pretty simple here, hopefully the solution is obvious to the community. 1. make event layer 2. export event layer to shapefile 3. re-project shapefile Code: InterpolationCSV = "path-to-csv" XCoord =...
View ArticleCheck whether a group layer is empty or not
Hello, I have an mxd file with around 100 layers and group layers. I'm trying to loop through all group layers and find out if they're empty or not (contains Feature class(es) or not). If a group layer...
View ArticleSelectLayerByAttribute_analysis HELP!!
Hey all, starting to get frustrated, if anyone can lend some clarity it'd be greatly appreciated. arcpy.SelectLayerByAttribute_management('mwstates','NEW_SELECTION','"STATE_NAME"=\'Illinois\' or...
View ArticleRun Python Script from Model Builder outside Arcmap
I have created a model builder that appends a Query Layer (view) in the SDE to an existing featureclass an this process works in Arcmap fine. However when I run the script out side arcmap I receive the...
View ArticleUpdate all the odd rows in a field with the value in the row above.
I need to update a field where all of the even rows have a value and the odd row below needs that value assigned to it as well. This needs to become This 1 - 1 0 - 1 2 - 2 0 - 2 1 - 1 0 - 1 I ideally...
View ArticleCalculate Field from a one to many relationship class
Hello Everyone, I have been trying to build a model that will take information from a Frequency table and put into my feature class. My problem is that I cannot join the two tables because the table...
View Articlerecording pixel value with Python script in ArcGIS 10.x
A scripting newbie question... I'd like to write a Python script for ArcGIS 10.x that would record the pixel value for all pixels in a raster. Furthermore, I'd like to only record a given value once in...
View ArticleCalculate distance from xy points to nearest raster cell of specific value
Greetings~ I have a time series dataset of ~400 points from WGS84 overlaid onto 40 polar stereographic raster layers (1/day). I have since converted the xy into meters and have a code to extract the...
View ArticleIs there anyway to programmatically create feature templates?
Hi, I use the automatic publishing procedure in arcpy (CreateMapSDDraft -> AnalyzeForSD -> ... -> etc etc) with great success. My script creates a Feature Layer programmatically, wraps it in...
View ArticlePython upload of local CSV file returns error - Error:500 Item does not have...
Hi, Help with the following issue (Error:500 Item does not have a file) would be greatly appreciated I have written the following python script with the assistance of some sample code I found and with...
View Article