Checking whether feature class has selection using ArcPy? [duplicate]
This question already has an answer here: How do you get all the results from a Selection made by Attribute or Location using ArcPy? 2 answers
View ArticleReplicating Summary Statistics tool with case field using own calculation...
I thought this would be a simple problem to solve, by my googling hasn’t provided the answers so far. I have created a near table (Using the ‘Generate Near Table’ in Arc) comparing two sets of points,...
View ArticleUsing ArcPy to identify Shapefiles instead of os.walk() via *.shp file...
I am trying to write a script that identifies all Shapefiles within my folder structure and write a list of the .shp files with their full path file name to a newly created .txt file. I was able to get...
View ArticleIntersecting overlapping polylines using ArcGIS for Desktop?
I have 4 multipart polyline shapefiles (download a sample dataset here). The geometries are identical, except for the length of segments in each shapefile. They represent 4 variables describing an...
View ArticleDefine Projections for layers with multiple locations in MXD's
# Script to use Layers in MXD source file paths to locate and redefine projections import arcpy, glob, os, sys, arcgisscripting mxd = arcpy.mapping.MapDocument("N:MXDs_ThomaKLMXD GPS...
View ArticleSelecting rows in a layer using arcpy.SearchCursor
I’m working on a project to identify points that fall along lengths of road. The roads are stored a single featureclass within a file geodatabase, as are the points. I’m using ArcGIS 10.3. I’m trying...
View ArticleUpdateCursor based on results from SearchCursor
i’m kinda stuck with an UpdateCursor. This is what I’m trying to do: each cell of a grid stores multiple answers that were given in a survey. For each cell I must choose only ONE answer, the one that...
View ArticleZonal histogram script VALUE row suffix problem
I’m running 2 Python scripts. The first it is to apply Zonal Histogram to several rasters. The second it is for saving the Zonal Histograms to a text file. My problem is when the first script creates...
View ArticleConvert searchcursor object to variable
(In advance i have to say that i’m a a self instructed greenhorn at python) I’ve vbeen struggling getting a seemingly simple job done: Using a python script, i would like to read through a table which...
View Articlematplotlib show() suspends ArcGIS
I’ve written a python script to plot a cross-section from a DEM along a line. Everything works fine except when I Show the plot, ArcGIS hangs and I have to force it to close with Task Manager. I am...
View ArticleHow to update annotations from fields values to annotations objects
I have annotations feature class and need to update some field offset and alignment values When I edits them manually at attributes table in ArcMap, new values applies to objects and they changes thrir...
View ArticleHow to control field properties when importing csv to Arc gdb [closed]
I am writing Python code to import csv files with UK postcodes to ArcGIS file gdb. The import works fine, however, text fields in newly created table in gdb have length of 8000 characters. Is there a...
View ArticleArcpy doesn't recognize spatialite tables after editing with QGIS
I’m working on a project that would like to use spatialite as a go-between for field edits using QGIS/IntramapsRoam and then loading the data to a file geodatabase. The workflow is as follows...
View ArticleUsing ReportLab with Arcpy
I am having some issues creating a geoprocessing service within arcmap using reportlabs pdf toolkit. The script runs fine outside of arcmap, however when i try and run it in arcmap to publish as a...
View ArticleConvert raster to polygon then join attributes
I’m trying to convert IMG files to shapefiles, then joining the attributes of the IMG file to the new shapefile. I got the conversion part to work, but am a stuck on how to join the tables. I have...
View ArticleMerge several .lyr files that contain a raster photo column
Shapefiles do not support raster files, so I created a geodatabase and made feature classes of the points. I then added a column titled “photos” and added the photo as a raster to the point. I now have...
View Articlewhy is python toolbox script not working standalone in PyScripter?
I am learning Python Toolboxes with PyScripter. I have a test python toolbox that outputs a raster file. It works when run from ArcCatalog. As I understand it, it should also run standalone within...
View ArticleRandom Value Generator
I have a python code where I am trying to assign a unique, random value to every row. I have tried: maxvalue = int(arcpy.GetCount_management(shape).getOutput(0)) + 10000 for row in...
View ArticleERROR 000358: Invalid expression Failed to execute (SelectLayerByAttribute)
My python script in ArcMap has an initial dialog box with two inputs: REG_CODE (values are in a list and include ‘AKR’, ‘IMR’, ‘NER’, etc) and Selection_type which offers ‘NEW_SELECTION’,...
View Articlearcpy.PackageWorkspace doesn't keep reference to SDE enterprise geodatabase
I am publishing a geoprocessing service on ArcGIS Server v10.3.0 that updates data on an ArcSDE Enterprise Geodatabase. I have the following at the beginning of my script: arcpy.env.workspace =...
View Article