A python API created by ESRI to perform geoprocessing and layer management.
2
votes
1answer
314 views
Is it possible to replaceDataSource of layer with dataset stored in_memory using ArcPy?
I use in_memory workspaces to speed up some Python script tools that get published as Geoprocessing Services significantly.
The tools open MXDs and perform, among other things, an ExportToPDF.
In ...
0
votes
1answer
14 views
Polyline will not turn into a feature layer via MakeFeatureLayer_management (arcpy)
I've got a python script that is connecting a sequence of points to make lines (script is based on answers to my previous question). To attempt to make subsequent processing more efficient, I would ...
0
votes
1answer
13 views
Python Code: “Compare two fields and select missing records”
The code I wrote is not right!! It's selecting more than what is actually missing. I think I'm wrong on the matched code line. I need the script to make a list of the "FLAG" field and a list of the ...
0
votes
1answer
62 views
How to Export to PDF after zooming to extent of each feature that meets SQL where clause?
I realize that I've asked two similar questions recently, but following suggestions in the comment chain, I'll make this a separate question (separate as it is not the no output problem in ArcPy: ...
1
vote
1answer
76 views
How to use CURRENT map document in Python tool?
I am attempting to use this code in a tool that I am working on:
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
XMIN = df.extent.XMin
YMIN = df.extent.YMin
XMAX ...
1
vote
0answers
12 views
mosaic raster to file geodatabase yields missing raster sections
Since upgrading to ArcGIS 10.1 (SP 1) from 10.0, I've been encountering an issue when running the arcpy.MosaicToNewRaster_management() tool with output to a file geodatabase. I'm principally working ...
0
votes
0answers
7 views
Fixing “spatial index grid size is invalid” without Recalculate button
I've got a python script that is connecting a squence of points to make lines, and putting them into a feature class (based on answers to my previous question). It works wonderfully on a small area ...
0
votes
0answers
9 views
Feature to Line on feature selections with ArcPy
I'm trying to collapse parallel polylines (dual carriageways in a shapefile of roads) to single centrelines. I'm aware of cartography's dual lines to centerline tool, but I find Feature To Line (Data ...
2
votes
2answers
984 views
Create Polylines from arrays of points
Let me describe the data setup. A line has been provided as an array of coordinate pairs, one for each vertex. This array is variable in size, anywhere from 2 to 200 coordinate pairs per line. What I ...
1
vote
2answers
32 views
Errors using SelectLayerByAttribute in ArcPy
I cannot for the life of me persuade SelectLayerByAttribute to work (I need to automate this for a complex script). Working in ArcMap's python console on already loaded shapefile, the format below:
...
2
votes
1answer
29 views
Arcpad checkout to an area
I would like to check out data from an SDE database but for performance sake, i prefer to delete all features outside of my survey area.
i've tried to copy features in area from sde to a file GDB ...
14
votes
3answers
1k views
Can i use ArcPy to get layer symbology?
Hello all
Since ArcGIS 10 comes with ArcPy package, i'm wondering it is possible to use ArcPy functions to get Symbology (i.e color, width...) of a layer?
Thanks in advance
2
votes
1answer
32 views
Reporting Engines used with ArcGIS Server
I'm curious what others are using to build the more elaborate reports out of ArcGIS Web API apps? By elaborate I mean ones that include lots of dynamic charts and tables, multiple maps/data frames ...
0
votes
1answer
24 views
Can an arcpy.da.SearchCursor be used on a dataset residing in a ParcelFabric?
I'm using ESRI's LocalGovernmentMI.gdb data model and am managaing parcel data in a ParcelFabric dataset. I'm trying to use a search cursor on the ParcelFabric_Parcels dataset but I recieve this ...
...
1
vote
1answer
293 views
Formatting label styles using arcpy
In ArcGIS 10.1, I have a shapefile/layer with labels displayed on a map. Can I modify any of the formatting of the labels using Arcpy? Either directly in code or by importing style from another layer ...
7
votes
1answer
82 views
Difference between python window and toolbox
Are there differences in performance or other potentially critical area between running a python script in the python window versus running it from the toolbox in ArcGIS 10.0?
I am asking in cases ...
1
vote
2answers
20 views
Select individual lines from feature class, convert to unique rasters: “raise e” error?
I have a feature class with 5 lines in it, and need select each one and turn them into its own raster -- for example, line 1 is raster 1, line 2 is raster 2, etc. This is the python script:
import ...
2
votes
2answers
53 views
Run Python child script using Python Add-In button class?
I have a Python script which I want to execute using Python Add-In button class. Right now, I am using following:
class child(object):
"""Implementation for Toolbar_addin.button2 (Button)"""
...
12
votes
1answer
228 views
How can I utilize NumPy arrays to optimize big data geoprocessing?
I'm interested in learning how to utilize NumPy arrays to optimize geoprocessing. Much of my work involves "big data", where geoprocessing often takes days to accomplish certain tasks. Needless to ...
2
votes
2answers
58 views
How to create network dataset for network assistant using ArcPy?
Is it possible to create a network dataset with arcpy to be used with the network assistant?
In the documentation I found the Build Network and Dissolve Network functions, but it looks like both ...
3
votes
0answers
43 views
Accessing arcpy functions from IronPython
I made a few python scripts to automatically optimize and publish my data..
Now i'm thinking about writing a .NET program to manage and run these scripts: the obvious way is invoking them in a ...
0
votes
0answers
67 views
python script to calculate and return values based on several conditions
I need to calculate and return the value "continuous" to those records in a polygon feature class with species records aggregated to a UTM grid
considering the attributes are species name, grid code, ...
10
votes
1answer
81 views
Watermarking photos using their geotag and create a shapefile
I have geotagged photographs and I would like to place a watermark of the photos location on the front for easy reference as well as creating a shapefile from the coordinates. Does anyone know of any ...
0
votes
1answer
24 views
UnboundLocalError: local variable referenced before assignment
I have following simple function to get percent values for different cover types from a raster. It gives me following error:
UnboundLocalError: local variable 'a' referenced before assignment
which ...
1
vote
2answers
60 views
Set Extents of MXD to new layer data source?
Alright here I go again this forum has been good to me. I add a layer and replace its data with a shapefile I created using the following bit of python:
layer = ...
2
votes
2answers
50 views
Create line from two points, two different feature class
I'm attempting to automate this in ModelBuilder in ArcMap. I have one feature class with one point (Start) and one feature class with multiple points (Destinations). I want to iterate through the ...
0
votes
1answer
38 views
Arcpy CreateUniqueName usage: keep original input names
This is a continuation of the question I asked here:
At this point I'm really just trying to get everything in one place and keep the original shapefile basename. I'll tackle merging like-named ...
1
vote
1answer
40 views
Read XY, get raster value and then update field
I've written a script to run through a point layer, using the SearchCursor in the data access module and then read the XY values. Within the with statement, I then use GetCellValue to get the ...
2
votes
1answer
69 views
How come “Zoom to Polygon” always puts me in the middle of Nebraska?
This is an issue related to this question I'd asked a few days ago. I've got that code working, to an extent. Every time, though, that I double click on one of the Polygons in the attribute table that ...
1
vote
1answer
46 views
Problem with calculating the total cell values
aa= arcpy.RasterToNumPyArray("water_depth")
sum = numpy.sum(aa)
print sum
-2933737
Why I am getting negative values ? In my raster there is no any negative ...
10
votes
2answers
444 views
Metadata -auto build using python
We have a large (10,000 plus) repository of spatial data (shp/gdb/tab vectors and ecw/tif rasters and also las, xyz and DEM data) where some have metadata records in xml using anzlic metadata editor. ...
0
votes
1answer
37 views
Using 3D Raster Domain to get polygon of raster - but stripping Z and M values
I'm trying to convert a number of large, floating point rasters into polygons so I can view overlaps etc. I've been using 3D Raster Domain sucessfully to do this. The only problem is that the polygons ...
0
votes
1answer
29 views
Arcpy Network Analyst solver error
Hello GIS Stack Exchange,
I am finding it difficult to load locations to sublayers using python in ArcGIS 10.0 network analyst Vehicle routing problem.
I'm also having some trouble debugging my ...
0
votes
1answer
39 views
How to insert values from one table into another?
I am trying to write a script that iterates through each row of a table, calculates for this row something. The result of this calculation is finally stored in another table (with just one row). Now I ...
1
vote
0answers
35 views
How to make multivalue input script run from a toolbox?
I have a working python script:
import arcpy
sdeconnection = arcpy.GetParameterAsText(0)
layerfiles = arcpy.GetParameterAsText(1).split(";")
for layerfile in layerfiles:
print layerfile
lyr ...
1
vote
3answers
61 views
Apply rotation before FeatureToRaster_conversion
I am converting polygon shapefiles to rasters. With arcpy I am using the function FeatureToRaster_conversion.
gp.FeatureToRaster_conversion(InFeatures, InField, OutRaster, InCellSize)
This function ...
0
votes
1answer
47 views
arcpy.setValue for Condition from Dictionary
Hi: I am trying to create a function to update multiple fields based on different criteria. I want to pass the field name and condition thru' a dictionary (please see the function description in the ...
1
vote
0answers
27 views
Different results from Spatial Analyst GP Tool and Python
I am writing a script that has to subtract one raster from another.
The rasters I have represent
1) Parking Lots (1 = Parking Lot, 0 = not Parking Lot) and
2) a buffer around the Parking Lot (1 = ...
0
votes
0answers
22 views
using python and arcpy , how can I compute the direction and angle of a line segment? [duplicate]
if start_point_x < end_point_x and start_point_y > end_point_y:
slope = ((end_point_y - start_point_y)/(end_point_x - start_point_x))
radian = math.atan(slope)
degrees = ...
0
votes
1answer
22 views
Add a time dimension in ESRI mosaic raster dataset
I am in the process of creating a script to pull daily .asc files from a ftp server, convert them to a raster format, and push them into a mosaic raster dataset. Ultimately, the raster dataset will be ...
2
votes
2answers
87 views
Help with Python and adding a grouplayer to arc, renaming it from a folder name, then adding layers to it from that folder
I am trying to use os.walk to go through a directory tree, pull out all the .shp files in it, create a grouplayer in the mxd, rename the grouplayer the folder name, then add the layers from that ...
1
vote
1answer
27 views
arcpy.setValue for Title casing
I am trying to figure out how to use fieldName.title() method while updating rows using updateCursor for multiple fields. I was trying to improve the code of this post to fit my purpose:
...
2
votes
1answer
70 views
Python script to update attributes crashing during loop
I have a script to update a field in one feature class from a selected record in another feature class. This is done through looping through records in one feature class selecting appropriate the ...
1
vote
1answer
80 views
Search cursor stops selecting after two iterations
I have a script which selects an extent from a grid and exports the data frame.
import os, arcpy
mxd = arcpy.mapping.MapDocument('CURRENT')
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
...
3
votes
1answer
93 views
Error with publishing Sort tool on ArcGIS Server 10
I have a model that has one tool (Sort), works fine on desktop. When I try to publish get this error.
Geoprocessing service initialization failed.
Invalid parameter: Tool - General Sort : Parameter ...
0
votes
1answer
87 views
Where Clause problems when all parts are user input variables
I have written some generic user ipnut code for a toolbox script (ArcGIS 10.0) but because everything is a variable I don't know how to write the SQL whereclause.
Please can someone help and suggest ...
0
votes
1answer
38 views
How can I hide custom model from mytoolbox in ArcGIS
I am created model in ArcGIS using model builder and python script. To build main model I have created some submodel and script in the same toolbox. I just want to show main model in the toolbox and ...
2
votes
1answer
64 views
How to write point geometries with arcpy instead of gp syntax?
Can someone help me fix some code that simply writes points into a featureclass? It used to work in the older gp. syntax, but I'm having difficulties rewriting it in arcpy for ArcGIS 10.0. In this ...
-3
votes
2answers
83 views
What does Runtime error : 'NoneType' object has no attribute '<field_name>' mean?
Here is my code
#arcpy
import arcpy,sys
from arcpy import env
env=r"C:\Users\Jaya\Desktop\python_practice"
totalRec=arcpy.GetCount_management("river")
rows=arcpy.SearchCursor("river")
...
1
vote
2answers
89 views
Arcpy to copy a layer in the ArcMap TOC, rename the copy, and paste back to TOC?
I want to make a copy of a layer in the ArcMap TOC (passed to my script as a Feature Layer), assign the copy a new name, set a definition query on it, and then add the copied Feature Layer back into ...







