A site-package created by Esri to expose ArcObjects to Python.
1
vote
0answers
10 views
How to automatically generate useful scales for data driven pages in ArcGIS desktop
I have been tasked with creating several hundred maps of properties that intersect a long pipeline. The maps will zoom to the part of the property which shows the intersection. The lengths of ...
1
vote
1answer
15 views
Why is arcpy.mapping.ExportToPDF losing layer symbology?
When exporting a map it does not export the symbology within the data frame. I am using the code snippet below.
>>> myMap = arcpy.mapping.MapDocument("C:/USERS/NISUSER/DESKTOP/mxd_map.mxd")
...
2
votes
2answers
63 views
Why use “ from arcpy.sa import * ”
Previously on the following post:
How to get an extent for Raster using python
A user edited the original Python script by adding the following code:
from arcpy.sa import *
Why did he do this and ...
0
votes
1answer
24 views
Apply lyr file to Arcpy
I am new to ArcPy, and don't know how to assign different layers to the same lyr file. The layers have "pol" in common. Replacement is a single layer, and so must be walked through the entire ...
0
votes
1answer
37 views
How to read shapefile of road segments into Python data structure to get begin and end point coordinates? [duplicate]
How can I take a shape file that has road segments and read it into a data structure in python that I can use to get begin and end points with? For example x, y to x2, y2.
It's not a large shape ...
1
vote
0answers
15 views
Fix broken SDE layers with Arcpy - unexpected error [duplicate]
We are in the middle of our ArcGIS 9.3 to 10.1 migration project and we have a lot of custom map documents (from different users) that among others, point to our current 9.3 SDE database. After our ...
2
votes
1answer
32 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 ...
0
votes
0answers
30 views
How can I iterate through subdirectories, isolate shapefiles only in that subfolder and merge them with an output named like the files in the folder? [duplicate]
I would like to specify a folder which contains multiple folders. Within each of these subfolders are six shapefiles. The six shapefiles need to be merged into one. The shapefiles are named like ...
1
vote
0answers
33 views
Is it possible to get field type information from FieldInfo object in ArcPy?
I'm looking at the FieldInfo object documentation for ArcGIS 10.2 and am not seeing access for field type (e.g. short, string, double).
Is it possible to get field type information from the ...
3
votes
1answer
36 views
Can I access the Error Log in arcpy?
Can the error log created by validate topology be assessed through arcpy? I can validate the following topology -
arcpy.ValidateTopology_management(r"C:\WorkSpace\CWD.gdb\FD\FD_Topology")
Can I ...
2
votes
0answers
37 views
How To Export Selected Data Driven Pages to PDF?
I have a map book with data driven pages that shows the fire boundaries, roads, etc for our fire rescue department. I want to automate the process of creating individual mini map books for each fire ...
0
votes
0answers
20 views
Consuming Forecast.io Radar Data in an API or ArcMap
I want to consume forecast.io's radar data as an ArcGIS Server REST or JSON to use in an API or ESRI's ArcMap GIS Software. MapBox is doing it here. I don't think forecast.io is currently making the ...
3
votes
2answers
54 views
Why does ArcPy Excel To Table give AttributeError: 'module' object has no attribute? [on hold]
I'm trying to import an excel workbook using arcpy. ExcelToTable, but I get the following traceback:
ERROR
updateParameters Execution Error: Runtime error Traceback (most recent call last):
File ...
1
vote
1answer
24 views
How to convert shapefile to KML file using ArcPy? [duplicate]
Python script that checks to see if a specific layer file exists in the current workspace
and, if it does, converts the layer file to a KML file. Does it work with a shapefile?
Code so far:
for file ...
3
votes
1answer
39 views
How to check if feature class or table contains field with specific name before adding it?
Im trying to write a script that finds out if the shapefile has a specific field and if not to add the field. I get it to show me the field, but the loop goes through each field, so it would create a ...
3
votes
1answer
63 views
How to change the style of the north arrow from “ESRI North 4” to “ESRI North 1”?
I have a Python assignment where I have to write a script to change the style of the north arrow from “ESRI North 4” to “ESRI North 1”. I wrote the following code:
import arcpy
mxd = ...
0
votes
1answer
52 views
ArcGIS ModelBuilder pass arcpy.SetParameterAsText as input to next tool
I am trying to build a model which uses two simple scripts, Script A and Script B. I want to use arcpy.SetParameterAsText to set an output in script A, which is then used as an input in script B. In ...
0
votes
1answer
50 views
Topo to raster doesn't work after exporting to a script [on hold]
ArcGIS 10.2
Topo to Raster now works.
# Import arcpy module
import arcpy
from arcpy import env
from arcpy.sa import *
# Check out any necessary licenses
arcpy.CheckOutExtension("spatial")
# Output ...
3
votes
1answer
32 views
Any case when one must use older ArcPy cursors (not da module based)?
I was using the arcpy.da cursors in ArcGIS 10.2 to iterate for quite some time now yet didn't use "classic" cursors that became available in 10.0 a single time. Is there any situation where one would ...
0
votes
1answer
29 views
How to compute geometric intersection using ArcPy?
I want to take geometric intersection of line and polygon shapefile. ArcPy has a tool:
arcpy.Identity_analysis
but it is available with "ArcGIS for Desktop Advanced" and I have "ArcGIS for Desktop ...
0
votes
1answer
31 views
formatting SQL expressions in arcpy
I'm trying to use SelectLayerByAttribute to find the last point added to a FC. I figured I could use the objectid field because it's serial. I wrote the following:
...
0
votes
0answers
37 views
using arcpy in python, having trouble with manipulating rasters [on hold]
In this script I am retreiving a list of data sources from mxds in a directory.
I want to copy all of the data to a new location (except if it is over a certain size).
I ran into the issue of some ...
0
votes
2answers
63 views
How to create a button that calculates acres on selected features
I'm looking to create a simple button that calculates acres on selected polygons and can't quite find what I'm looking for. I read through this thread: automating a python script..., but found it ...
0
votes
2answers
45 views
Get and compare area of arcpy geometry from extent object
I'm trying to get a numerical value for the area of a polygon that I am generating from an extent object. In this case, I am using the "onRectangle" function in the python addins for arcpy. The ...
1
vote
1answer
34 views
layer.visible command not working in arcpy.mapping module
I am using the arcpy.mapping module for the first time, and the lyr.visible command is not working as it should (or I am not using it as I should). I have a list that contains the the layer names of ...
1
vote
2answers
51 views
Find index location of a lat/lon point on a raster grid in ArcPy
This question has been confusing me for a while, and I'd love y'all's help.
I'm trying to find the index location on a raster (in terms of column and row#) of a specified lat/lon point.
My first ...
0
votes
0answers
55 views
I need help understanding the syntax for the a python dictionary default value
Just want to clarify what is happening in my code.
I have develped a loop which iterates through linework, buffers the line and then compares the tablulated area of Forested, Open and nonhabitat ...
2
votes
2answers
44 views
How to define workspace as input for GP tool in order to select from list CAD layers as the second input?
How to define workspace (folder) as input for gp tool in order to select CAD layers as the second input that will be obtained from the first input?
1
vote
0answers
50 views
Why does CON statement give ERROR 010240: Could not save raster dataset to (value) with output format GRID?
I am receiving the following error when trying to run the following code:
import arcpy
from arcpy import env
from arcpy.sa import *
arcpy.CheckOutExtension = "Spatial"
env.workspace = ...
2
votes
1answer
44 views
ArcPy findAndReplaceWorkspacePath not working with Raster Datasets
Situation:
I am working on creating a Python script that will replace workspace paths for every layer in a map document in order to fix broken layers after a data migration. The script works except ...
1
vote
1answer
34 views
“dataset does not exist or is not supported” using large GRID raster
I am trying my hand at arcpy for the first time to create a conditional raster from a set of threshold values. I have 3 large GRID format rasters (mos_zb3, mos_zb4, pca_finb2) I am trying to feed into ...
4
votes
1answer
95 views
How to Receive an Email after a script has run?
I'm working my way through my first attempt at scheduled tasks with modelbuilder and python. So far I have:
Created a model that reconciles our SDE versions and then compresses the database.
...
4
votes
1answer
49 views
Managing symbology in Feature Classes
I'm using an enterprise db to store my data and I'm writing a python tool that allows me to interact with that data in ArcMap. However, all my layers someone have "OTHER" for the symbologyType (not ...
2
votes
1answer
26 views
Invalid SQL Error when using InsertCursor on table created using CreateTable
I am trying to write a list of items to a new table in Arc. When I attempt to add a new row to an Arc table, I get the following error:
Runtime error
Traceback (most recent call last):
File ...
2
votes
2answers
31 views
Calling variables within ArcPy functions
I have a defined function (ex. def my_function(x,y)).
def my_function(x,y):
"""algorithm"""
my_variable = my_function(filex, filey)
How can I call this variable within the code block section of ...
2
votes
1answer
83 views
Buffer based on SQL expression
Is there any way to optimize this code? It creates two buffer feature classes based on two different fields in the shapefile attribute table
import arcpy
from arcpy import env
## Set Workspace
...
2
votes
2answers
41 views
ArcGIS 10.2 Geoprocessing Service based on Python Fails with IOError: “SDE” does not exist Failed to execute
I have a Python Script that inserts X,Y Point in the SDE Point Feature Class. It works fine when executed in ArcMap 10.2, but it fails with IOError when published as Geoprocessing Task service in ...
1
vote
1answer
20 views
How can I avoid creating a new cursor object repeatedly while counting features in a large SDE Database?
I would like to get a script running much faster than it is now. The script completes on my machine in about 33 minutes. It generates a report that counts features with specific attributes in one ...
1
vote
0answers
20 views
How can I output an arbitrary number of file urls from a Synchronous Geoprocessing Service?
Scenario:
Custom Export Service. The service creates zip files with shps in them and return the url to the file. I understand if you intend to to run this in synchronous mode, you must have a tool ...
1
vote
0answers
28 views
Weird Error when setting the source path in the “PICTURE_ELEMENT”
I am trying to set the sourceImage to a tiff file using this code:
m=1
pic = arcpy.mapping.ListLayoutElements(mxd,"PICTURE_ELEMENT" , str(m))[0]
pic.sourceImage = ...
2
votes
1answer
47 views
Python getting area of multipart features with SearchCursor()
I am tasked with programatically getting the area of each individual part of a multi-part feature. I have a script already to read each individual part and print its XY coordinates and it works fine ...
0
votes
1answer
44 views
populating one field value based on another field value
I have a feature class in a personal geodatabase with 2 fields. They both have domains set up to ease the editing process for my users. If my WaterType field is set as "Not Irrigated" (or code 4) then ...
3
votes
3answers
98 views
How does one replace characters in a layer name using Python (“_” with “ ”)? [closed]
I can rename layers easily enough, but I really need to replace any "_" with a " ".
This code just renames layers, but I would like to do a find and replace on each layer name
mxd = ...
1
vote
2answers
46 views
Reducing number of decimal places after X/Y coordinates in a FC
I'm using arcpy.AddXY_management to add coordinates, and I want to reduce each X/Y field by x number. I've tried to reduce it by string slicing and that obviously didn't work. I also tried setting the ...
2
votes
0answers
43 views
Near Analysis takes much longer in ArcPy? [duplicate]
I have a feature class of about 12 points, a feature class of hundreds of roads, and need to find the nearest road to each point. So the obvious solution (Near tool) takes about 20 seconds, and the ...
2
votes
1answer
52 views
Python scripting for making rings from the city center
Problem description:
I have two layers: 1) [Polygon] city blocks, and 2) [Point] the city center. The City blocks layer has 110,681 records. And The city center layer has just one record because ...
2
votes
1answer
45 views
Embedded python script module import issue
I have two ArcGIS python scripts. One is a primary python script that calls a number of functions from a second python script.
Everything works well, i.e. primary tool calls and uses functions from a ...
4
votes
2answers
133 views
Automating a Python expression to calculate acres
I'm not new to GIS but very, very new to using Python and using scripts. I successfully use a Python expression !shape.area@acres! to update a field with acres in a feature class.
What my users ...
1
vote
0answers
29 views
iisnode with ArcPy
I am calling the child_process in Node to trigger a python script which is importing ArcPy. This works fine until I start sending requests through IIS. Python runs, but importing ArcPy fails. I have ...
5
votes
3answers
108 views
accessing the output of a python script tool dialog ArcGIS 10.1
Hi I have a a fairly simple script tool dialog which has been setup to get 6 parameters from the user and return them as the tool output as a list. the aims is that the out put would then be used ...