A python API created by ESRI to perform geoprocessing and layer management.
2
votes
2answers
38 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 ...
1
vote
2answers
50 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 = ...
1
vote
1answer
29 views
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 ...
0
votes
1answer
36 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
36 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
42 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
441 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
36 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
27 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
33 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
33 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 ...
2
votes
0answers
27 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 ...
1
vote
3answers
60 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
44 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
25 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
21 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
85 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
26 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
69 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
78 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 ...
2
votes
2answers
48 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 ...
0
votes
1answer
83 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 ...
0
votes
0answers
15 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 ...
2
votes
1answer
59 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
82 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
78 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 ...
1
vote
1answer
56 views
Setting More Than One Workspace
I have a number of tables that contain known values in a field. For example, I have a soil type table with one field in it. That field contains a list of known soil types. I have another table that ...
2
votes
1answer
267 views
Can't import arcpy in IDLE, pyscripter, or even ArcGIS10.1's Python window
After using arcpy and python for months with ArcGIS 10.1 without any problems I'm encountering something I can't work around or even find help with online. Something as simple as "import arcpy" is ...
0
votes
1answer
335 views
How to use variable field name in arcpy.SearchCursor?
I have code that says
fld = fieldName
rows = arcpy.SearchCursor(fc)
for row in rows:
x = row.fld
How do I use a variable for my field name in python ArcGIS 10 on windows? Thanks.
3
votes
2answers
190 views
Merge Spatially Coincident Features in the Same Feature Class
I need a way to programatically merge grid cells (polygon 15x15m) that are directly on top of each other and add together some of their attributes.
I am working in ArcGIS 10.1 with the data stored as ...
1
vote
1answer
43 views
Need python code example - setting a combo listbox to Null
I want to be able to set the value of a field to Null using python, but I get an error.
I am using arcpy.CalculateField_management
Any help would be appreciated.
Rob Smith
1
vote
2answers
73 views
arcpy.sys versus sys
I just noticed that in the arcpy module (Esri) there's a sys sub-module. Does anyone know what the difference is in using one or the other? I've been looking around and can't find anyone who uses ...
13
votes
5answers
487 views
How to make a GIS inventory?
My office will be seeing a big change in its GIS section. This section has been operational since the 1980's and has a huge collection of GIS data (i.e., shapefiles, raster files, data, etc) but never ...
3
votes
2answers
73 views
arcpy Problem with updateRow() when trying to update fields with UpdateCursor
I have a list of values which I am trying to add to an existing shapefile. The field where the values need to be inserted has been added via arcpy.AddField_management and thus the values of the rows ...
0
votes
0answers
13 views
MapInfo8.0 is not letting me edit layers imported from the server? [duplicate]
I have imported 4 layerts from my server for use in MapInfo, when i went to edit these layers the edit tool for each of these layers is grey and non accessible.
Any suggestions would be greatly ...
6
votes
2answers
87 views
Refresh open attribute table in ArcMap (arcpy)
I am running the Calculate Field GP tool from the arcpy in ArcMap. When a row value is updated, it does not show up untill I use the Reload Cache tool (Table Options > Reload Cache). How do I refresh ...
5
votes
1answer
159 views
Changes in synchronized replica not shown in ArcMap or ArcCatalog without refreshing
I am synchronizing a one-way replica in ArcEditor using Python. I tried adding RefreshActiveView and RefreshCatalog to the code, but I still need to refresh the synchronized database to see the ...
4
votes
1answer
37 views
Using matplotlib to create and export graphs automatically from ArcMap
I am going to start a project soon where, after the data has been processed in various ways, an output jpg showing a graph of the data should be produced. The workflow is as follows:
1. A feature ...
5
votes
1answer
507 views
Script tool Value error
I've been struggling to get my script tool to run without receiving the following error:
<class 'arcgisscripting.ExecuteError'>: Failed to execute. Parameters are not valid.
ERROR 000735: ...
6
votes
1answer
1k views
Python Script to Create Table Using Data Driven Pages
I am trying to convert some python script to display a table (based on a dbf) of features located within a specific data driven page. So far, I have the script successfully able to refresh the map to ...
3
votes
1answer
93 views
changing symbology
I have problem with my script. Layers are in one geodatabase, and have names like: orne1942, orne 2003, orne 2009 (the same forpart e.g. orne). Script should changing symbology layers wich have the ...
1
vote
0answers
24 views
Problems running zonal statistics - not all zones represented
I have been working on a Python script to automate the steps illustrated by whuber here:Create points around the edge of viewshed results
I am trying to create a horizon graph illustrating the ...
0
votes
1answer
19 views
How to add layer in Arcscene using script tool
import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "*")[0]
addLayer = arcpy.mapping.Layer(r"F:\project\Final\Ground floor\steps.lyr")
...
2
votes
1answer
44 views
How can I set the settings of an Address Locator within a Model or arcpy?
I am creating a model that processes a large road dataset, then creates an address locator from the roads. The Create Address Locator tool does not allow me to set options like Spelling Sensitivity or ...
0
votes
0answers
52 views
ArcGIS opposite to pivot table
fellow GIS-ers :)!
I've been trying to find a tool to do the opposite to what the "pivot table" tool does but I dont thin there is any tools for that. I have a raster data set derived from Landsat ...
1
vote
2answers
60 views
How to Add Shapefile with Symbology from Layer File to ArcMap MXD using ArcPy/Python?
Say I have a Shapefile:
C:\DATA\points.shp
A layer file:
C:\SYMBOLOGY\symbology.lyr
And a map document:
C:\MAPS\map.mxd
How can I add points.shp to map.mxd with the properties of symbology.lyr ...





