A site-package created by Esri to expose ArcGIS for Desktop (and ArcGIS Pro) geoprocessing, mapping, etc, to Python.

learn more… | top users | synonyms (8)

4
votes
2answers
127 views

Incorporating several Python script tools into one tool and have user input determine section of script run?

I have a series of script tools created and work well in ArcMap 10.2.2 just fine. These tools generate a series of buffer features from an input feature class. I have these as separate tools each ...
4
votes
1answer
188 views

Setting “Always run in foreground” within ArcPy code?

Is it possible to set the "Always run in foreground" option within ArcPy code? I haven't found anything on this yet? It would be nice to be able to specify within a script, instead of through the ...
4
votes
1answer
195 views

Checking if layer is visible in legend using ArcPy?

I want to be able to check if a layer is visible in the legend and if so then perform another operation - in python. I am using ArcGIS 10.2 for Desktop. I cannot find anywhere how to check if a ...
4
votes
1answer
1k views

Objects in this class cannot be updated outside an edit session inside ArcFM?

I'm trying to add a feature class in ArcMap 10.2.1 that is an ArcFM Feature Class by using a python script. I am working inside an ArcFM session which is required to edit the layer I am working with, ...
4
votes
2answers
1k views

How to check if an ArcGIS extension has already been checked out manually in arcpy?

I've written a python script that uses a Spatial Analyst function and hence requires the Spatial Analyst extension to be enabled. I would like to be able to check out the extension only if it hasn't ...
4
votes
3answers
226 views

Select the most distant vertex from polygon's centroid using ArcPy

I have a poligon and the polygon's centroid. I want to select the most distant vertex from centroid (picture: point A). I used arcpy.FeatureVerticesToPoints_management to create a feature class ...
4
votes
2answers
128 views

Performing a 'far analysis' using ArcGIS for Desktop?

I would like to perform an analysis that is the inverse of Near_analysis for ArcGIS. Instead of my result being NEAR_DIST and NEAR_FID, I'd like each feature to have a FAR_DIST and FAR_FID populated ...
4
votes
2answers
2k views

What is the most efficient way to search a geodatabase for NULL-like records?

The problem: I have a geodatabase with several datasets and many more feature classes within. The fields within the feature classes have been populated through joins with shapefiles and manual edits. ...
4
votes
1answer
2k views

Customizing right click (context) menu of selected feature using ArcPy?

I want to confirm whether arcpy can customize the right click menu of the selected feature, which means I want to remove the default items and add in my own item. The following pictures show what I ...
4
votes
1answer
1k views

Most efficient method to join multiple fields in ArcGIS

I have as set of shapefiles with approximately 300000 polygons each, as well as corresponding point shapefiles and tables with approximately the same number of row (equal or less rows than the ...
4
votes
3answers
4k views

How to extract data using arcpy.da.SearchCursor

I have a shapefile of point features showing fire locations in a given year. One of the fields is named "YYYYMMDD" and indicates the corresponding date that that fire happened. In Python, I am trying ...
4
votes
1answer
1k views

Edit SQL Server table (not registered with geodatabase) with arcpy

I am trying to update some rows in a SQL Server database table (not registered with geodatabase) with arcpy.da.UpdateCursor. However, when running the deleteRow(), I get the error return without ...
4
votes
1answer
819 views

Convert linear polygons to lines

Hi I have some long linear polygons that I'd rather store as lines but I'm not sure how best to do this. Ideally I'd have a line goiung through the centre of the polygon lenthways. I have two ideas of ...
4
votes
2answers
2k views

Getting XY coordinates and field values for each row in ArcPy SearchCursor?

I am trying to enumerate each row of a points shape file and get a certain field's value (elevation) and the xy coordinates. But I see I can only use: arcpy.SearchCursor to get the field; OR arcpy....
4
votes
1answer
316 views

Why does arcpy.ListFields list GUID field as SmallInteger?

I want to get a list of all GUID fields in a feature class, but it seems that arcpy.ListFields is listing my GUID field as a SmallInteger. What am I doing wrong? global_id_fieldnames = [f.name for f ...
4
votes
1answer
1k views

How to convert all shapefiles in folder into KML using ArcPy?

I was trying to convert all the shp in a folder into kml. featureclasses = arcpy.ListFeatureClasses() for fc in featureclasses: # Set Local Variables composite = 'COMPOSITE' pixels = ...
4
votes
3answers
2k views

What causes RuntimeError: ERROR 010240 saving after CellStatistics?

I am having trouble saving outputs from CellStatistics but only when I run it on a list of rasters. This was working on python 26 but not 27. I know this example is nonsense, but: env.workspace = ...
4
votes
2answers
1k views

Select by attribute expression invalid in python

I'm not sure how my expression is failing. Any ideas? inPoints = "points.shp" i = 0 arcpy.MakeFeatureLayer_management(inPoints, "pts") arcpy.SelectLayerByAttribute_management("pts", "NEW_SELECTION", '...
4
votes
1answer
171 views

Arcpy error message: 'Layer' object is not subscriptable?

What the code does successfully so far, is gets a list of the layers in the first data frame of the current map. What it doesn't succeed in doing is, joining the layer names to the gdb location using ...
4
votes
1answer
4k views

Detecting duplicate attribute values in table using ArcPy without Advanced/ArcInfo level license?

In ArcMap, the right-click Summarize option very quickly creates a frequency listing of the chosen field: Note that the count field shows the count of duplicate values. How can I access this ...
4
votes
2answers
1k views

Arcpy remove invalid character

I've built a model that takes the name of the Excel worksheet containing xy data, and uses that name as the name of the output shapefile. ( Worksheet "massachusetts_sightings" in an xlsx becomes "...
4
votes
2answers
2k views

Delete all fields from feature class with arcpy

I want to delete all of the fields from a feature class in a simple tricky way, I don't want to loop over the fields because this method is very slow in arcpy. I'm using a polygon feature class, I ...
4
votes
1answer
536 views

String format for geodatabases in ArcPy scripts

Several ArcPy functions take strings as geodatabase identifiers. I've looked through the ESRI docs, but can't find a good reference for the various acceptable formats. I'm looking for examples of ...
4
votes
2answers
1k views

Field calculation- Arcpy

I am developing a script to calculate the values of two fields (C and D) based on value of field A (It is a Point feature): A C D 0.2 1 1 0.2 1 2 0.2 1 3 0.4 2 1 0.5 3 1 0.5 3 2 So the idea is n =...
4
votes
2answers
2k views

Running ArcPy script from ArcObjects?

the standard method requires to run ArcPy script in command line, i've struggled with it to run but without a result, i can import arcpy, set the workspace to the geodatabase path and describe the env ...
4
votes
1answer
832 views

Iterative position within Field Calculator/Python

I'm not great with Python or programming in general, so I'm not even sure how to ask this question. Basically what I've got is in the left column, and what I want is in the right column. UniqueID ...
4
votes
1answer
703 views

Convert point XY to page units XY using arcpy?

I am using arcpy to export PDFs from my ArcGIS Server application. I want to move a TextElement in my layout view to the centroid of a selected feature. I can get the centroid of the feature, but that'...
4
votes
2answers
965 views

Updating ArcMap links to ArcSDE Geodatabase feature classes?

I've seen questions about attemting to repair a .mxd file with broken links. What I would like to do is get ahead of this issue and "fix" it before it becomes a problem. I have my data in an ArcSDE ...
4
votes
3answers
1k views

Automatically creating 2D-point features for ArcGIS Desktop from addresses in SQL database?

I currently have an SQL-Table which contains our buildings. I already added the table and now want to create features ( 2D-Points ) from that information. The biggest problem I have is that the "...
4
votes
3answers
94 views

Batch Clipping Single Raster with Multiple Shapefiles in ArcPy?

I have a single raster file and about 40 small polygons shapes. I would like to clip the raster by the extent of all these shapes, and create 40 resulting .img files. I know I can just do this by ...
4
votes
1answer
112 views

Converting python script to toolbox?

I am trying to convert my plain python script to script in ArcToolbox to share, where user can set input data (in this case, feature class). Unfortunately, Converting Python (ArcPy) script into tool ...
4
votes
1answer
53 views

Change entire label style after certain extent

I need to design a dynamic label in ArcMap that changes its entire style after a certain zoom extent. The research I've done suggests to me that there is currently no way to use VBscript to manipulate ...
4
votes
1answer
58 views

ARCGIS Calculate Value Tool - Always returns same value

I want to check if an environmental shapefile was generated from a previous process. I utilized the Calculate Value tool in Modelbuilder but the problem is that no matter if this Wetlands layer ...
4
votes
1answer
57 views

Arcpy and multiprocessing not working

I want to utilize multiprocessing within my arcpy scripts but my first test has run into a problem which I don't understand. I'm running the script in the python window: import arcpy from ...
4
votes
3answers
205 views

ArcPy.da.UpdateCursor error The requested operation is invalid on a closed state

Hello I am getting an error when trying to use the arcpy.da.UpdateCursor(). The error I am receiving is as followed The requested operation is invalid on a closed state I am in the python ...
4
votes
1answer
51 views

Using findAndReplaceWorkspacePaths to change picture path element- ArcPy

Picture element, in 60 MXD files, disappear and there only blanked rectangle instead. I know one way to solved it, by go to the picture properties-->picture tab. But i try to find a way do it with ...
4
votes
1answer
241 views

Managing environment variables in arcpy?

The Arcpy documentation seems to suggest that when writing python scripts that utilize/modify variables in arcpy.env, you should wrap everything in a bunch of try/except/(finally) loops with custom ...
4
votes
1answer
235 views

Match features that are spatially similar with ArcGIS?

I'm hoping there might be a way to match features from one feature class to features of another feature class that are the most spatially similar. I have two datasets representing the same thing that ...
4
votes
2answers
269 views

How to Parse Unique Address Data

I'm trying to parse some funky address data into separate fields either using ArcMap's Field Calculator or a Python Script. Currently, my address data including street number, street name, and unit/...
4
votes
2answers
278 views

How to randomly move points?

I have a feature class with a large amount of points. My purpose is to randomly move these points to see what happens as a result. Are there specific tools or Python programming methods to accomplish ...
4
votes
2answers
261 views

arcpy.da.SearchCursor ignores the where_clause parameter?

I'm trying to use arcpy.da.SearchCursor to go through records in a feature class stored in a SQL SDE database. I do so through a feature layer (created in arcpy) called "unit_lyr". When I run the da....
4
votes
1answer
68 views

Is it possible to set data source of ArcMap MXD via replica MXD on remote server?

I have two ArcGIS Server instances, one is development and the other is production. I've copied the MXDs and .msds from my ArcGISServer folder on server one to server two for back up. Instead of ...
4
votes
2answers
222 views

How to check for corrupted raster data?

I am working with thousands of tiled (2km x 2km) 4-band NAIP images. When I diced the images in Erdas, the program corrupted many of the tiles. The screenshot shows an example of one of the ...
4
votes
1answer
348 views

Create conditional to check if raster has value

I have a problem with this code: ac = ExtractByMask(raster, "area.shp") arcpy.RasterToPoint_conversion(ac, "point.shp", "VALUE") The problem is that sometimes the raster has no value. (It's a flow ...
4
votes
1answer
182 views

Arcpy Cell Statistics - maximum number of input rasters

I am running cell statistics in arcpy. Essentially I am summing together a folder of grd files to create a new grd representing their sum This will eventually take place on a folder of 20,000 raster ...
4
votes
2answers
414 views

How to transfer attributes to thousands of local points from ArcSDE feature class with millions of polygons?

I have a set of points and a huge feature class with topographic information (OS MasterMap for who knows it). I'm talking millions of polygons huge. I want to transfer attributes of the polygons to ...
4
votes
1answer
5k views

Getting arcpy.AddMessage() to display message from script tool called from another script tool?

I am using a Python script tool within an ArcToolbox in ArcGIS 10.2. The script calls another python script tool while running but does not display the messages from the called script when using ...
4
votes
1answer
190 views

Is it possible to store a default symbology layer in an arcpy add-in?

Since arcpy is limited in how symbology can be manipulated, I was curious to know if a symbology layer can be stored in an arcpy add-in. Does anyone know if it is possible to store a .lyr file, or ...
4
votes
3answers
1k views

Additional Parameters for PrintTask?

Hi Guys I'm writing a custom GP tool for printing with 10.1. I need to pass some additional parameters into GP tool. I'm using printTask from jsapi and I couldn't add more parameters just by adding to ...
4
votes
2answers
2k views

Append or merge consecutive line segments (contours) as one single line of the same elevation value

Is there a way using python (ArcPy) or ArcGIS 10.1 tools to collect consecutive line segments having the same elevation value and appending/merging/generating one single line from them? Each resulting ...