A site-package created by Esri to expose GeoProcessing from ArcGIS to Python.

learn more… | top users | synonyms (7)

4
votes
2answers
354 views

Get value from Metadata in Python Script for attribute

I am working on a python script to create some feature classes from dbf tables. As part of the script I would like to pull two values (FGDC "publication date" and ArcGIS Spatial Reference ArcGIS ...
4
votes
1answer
3k views

Calculating geometry area in ArcGIS for Desktop using ArcPy?

I have a polygon shapefile and I want to write a Python script to add a field named "area" and calculate its geometry areas. The script is like this: ...
4
votes
1answer
734 views

How to change text legend orientation from right to left reading with arcpy

I working on mxd with ArcMap 10.3 . The default's legend properties is- Layout - left to right reading (Marked with a red ellipse) : when it unmarked i get this legend: i want to know if there a ...
4
votes
1answer
392 views

How to automatically check for lidar flight line overlaps?

I have a series of lidar-based raster products created via FUSION. Since I am working with low density lidar data, many of the raster images show significant striping where lidar returns overlap on ...
4
votes
2answers
2k views

How to specify map service parameters when publishing with arcpy?

I publish map services on a ArcGIS server using the typical arcpy script below. I need to better specify some service parameters. For example, the service should be available in WMS instead of KML, ...
4
votes
1answer
2k views

Use arcpy to connect to database without connection file

It seems like arcpy can only work with connection files. This creates one of two problems: Deployment requires manual creation of connection files. We have to write a bunch of code to recreate the ...
4
votes
1answer
2k views

Defining Feature Set parameter for ArcGIS Python Toolbox tool?

I'm trying to create an ArcGIS Python Toolbox tool which uses a polygon for input. I want the user to be able to create the polygon when the tool is run. I know how to do this using both a ...
4
votes
1answer
1k views

copy feature class and retain selected fields with arcpy

I've got a featureclass (fc) that I want to copy, but only retaining a selected number of fields, let's say field 9, 11, and 12 from the total of 15 fields. I want to use arcpy and suspect that ...
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
1answer
424 views

How to generate overlapping polygons from lines output from Table To Ellipse tool?

I have a feature class of line-based ellipses generated by the Table to Ellipse tool that looks like this: What I want is polygons of the individual ellipses, however tools like Feature to Polygon ...
4
votes
1answer
2k views

How to reduce time for 'Export to PDF' (or any other alternative to print maps) in Python?

For my work, I designed a tool to create PDF maps with large amount of data, intersected with 5 buffer rings using ArcPy. The job involves intersecting points, selecting points, generating Elevation ...
4
votes
2answers
468 views

Moran's I z-score in ArcPy

I have a ArcPy script to calculate Moran's I several times (50 to be precise). However, I am not interested in the Moran's I value, what I need is the z-score returned by the tool. Even though the ...
4
votes
1answer
2k views

How to merge many shapefiles in different folders?

Directory structure is basically as such: county\City\prep\POI\Completed\C1, ...C2, ...etc\ I'm trying to write a script to go through the *\Completed*\POIS.shp and merge them all together, at a ...
4
votes
2answers
3k views

Creating empty group layer within existing group layer using arcpy.mapping?

Referencing this question, Adding new group layer with ArcPy?, I'm trying to use python to add a empty group within a group layer. So far I'm able to add a empty group within the map document, ...
4
votes
1answer
875 views

Access Metadata from ArcSDE-tables using python

Is it possible to access the metadata of a feature class in a ArcSDE-data, using arcpy / python (on Arcgis 10.0). I suppose I could export the metadata to xml and parse the xml, but is there a more ...
4
votes
2answers
388 views

Getting junction id for roads in network dataset using ArcPy?

I have a network dataset with roads and junctions. I am wondering what class I can use in ArcPy to extract FromJunctionId and the ToJunctionId for each road segment in the network dataset.
4
votes
1answer
519 views

Programmatically export to geotiff in different scales from ArcGIS Desktop?

I would like to programatically export geotiff files in different scales (e.g. 1:25000, 1:50000 etc) using arcgis10. As input I have some shape files and a DEM file as well as a corresponding style. ...
4
votes
1answer
605 views

How to best organize files for a large arcpy script tool?

I am writing a lengthy arcpy tool and am working with multiple python scripts, simply for organization's sake. Everything runs well when I run it from the command line, but now that I am starting to ...
4
votes
1answer
2k views

Getting a constant background color for transparency

I am creating a series of tif files at 1:10k scale over a vast area (760 tiles) using arcpy.mapping.ExportToTIFF and then stitch them together to create a single ecw. The output looks ok but when I ...
4
votes
2answers
4k views

Using arcpy from the command line on ArcGIS Linux Server 10.1

We installed ArcGIS SERVER (not Desktop!) 10.1 on a RHEL (Red Hat) machine. ArcGIS Sever is supported for Linux. However, it appears they don't make it easy to script in python, from the command ...
4
votes
2answers
2k views

insert cursor “Row contains a bad value”

I'm having a problem copying data from a shapefile to a feature class using an insert cursor. Here is the part that is causing trouble: newRows = arcpy.InsertCursor(Target) sourceRows = ...
4
votes
3answers
1k views

Using threading module with Arcpy: Manager/Worker architecture

I asked this question on Stack Overflow on how to setup a manager/worker scenario. But I am getting some error when trying to use threading on my Python install with ArcGIS 10 (just the python ...
4
votes
2answers
2k views

arcpy: check for same record in cell above and below

After using the find duplicates in arcmap 10, I want to check if the feat sequence ("find duplicates" marks all records with the same attributes with the same number [in "feat_seq"] and creates a ...
4
votes
2answers
200 views

Spawning a process from ArcGIS ToolValidator

I attempted to spawn a separate process from the ArcGIS ToolValidator script. Unfortunately, it launches another instance of ArcCatalog. What is going on behind the scenes that causes ArcCatalog to ...
4
votes
2answers
236 views

Appending Point Shapefile Location by GPS values in text file using ArcPy?

In my industry it is common to create preliminary design maps for point locations that have a unique identifier. Upon the actual construction on the design, points change location based on ...
4
votes
2answers
1k views

How do you get access to a Network Analyst layer item in ArcPy?

I have a Python script that I'm working on. I have created a Closest Facility layer (in memory). I add facilities. I add incidents. I perform the Solve. These all complete. The only problem is, ...
4
votes
2answers
3k 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 ...
4
votes
1answer
917 views

Can I change the font type in all Text_Elements in a page?

I want to change all the font styles in a number of mxd's from "Lucinda Sans" or whatever the current one is to "Arial" without changing the font size. I wrote a simple script to find/replace text ...
4
votes
1answer
918 views

occasionally empty search cursor looping through a raster list with arcpy

I'm looping through a raster list, to export cell counts (from "Count" field in the table) to a text file, I'm only interested in cases where the field "Value" = 1, so I have included this in my ...
4
votes
1answer
48 views

Update row with next row's value

I am trying to extract the endpoint of a line with very fine scale and overlapping GPS data. I would normally just use the locn_id+1 but that doesn't work because the data were originally rarified. ...
4
votes
1answer
44 views

Access to graph properties in arcpy

I am using data driven pages and arcpy.Graph() object to automate production of synchronised map/long-section series similar to this: I'd like to keep vertical scale for long-section part. In order ...
4
votes
2answers
87 views

How to prevent arcpy from adding new features to current workspace

I have the attached code. The code takes a huge raster, and a set of point features. For each of them creates a circular buffer (100), then squares it, and then clips that part of the buffer. In doing ...
4
votes
4answers
177 views

Swapping Lat and Lon coordinates of shapefile?

I have a shapefile that consists of one polygon whose boundary is defined by a large number of points. Whoever originally made the file inverted the latitude and longitude coordinates, so the data ...
4
votes
1answer
100 views

Importing MXD to ArcGIS Pro programmatically?

I have a problem with importing an MXD file to ArcGIS Pro programatically. I try to do this by using the following arcpy.mp code: import arcpy aprx = arcpy.mp.ArcGISProject(r"C:\test\blank.aprx") ...
4
votes
1answer
303 views

What is the difference between data access's “SHAPE@XY” and “SHAPE@TRUECENTROID” tokens?

Data Access Search Cursor. What, if anything, is the difference between the tokens "SHAPE@XY" and "SHAPE@TRUECENTROID"? They returned the same coordnates on a test polygon: >>> cursor = ...
4
votes
1answer
60 views

Excluding pages without point within extent from Data Driven Pages?

ArcMap 10.2 I am creating a utility mapbook to show HVAC points on an installation. The data driven pages are named and sorted by a separate layer (area feature class). There are 70 named areas, ...
4
votes
1answer
140 views

Automatically create new layers from a single dataset using definiton query for unique values in a field

I would like to automatically display a featureclass as different layers based on a specific field. I've seen a few tools online and on XToolsPro under the category of Split by Attributes, but they ...
4
votes
2answers
303 views

Fastest way to numerate intersecting polygons in ArcGIS

I need to numerate a thousands of polygons in groups, so each group will get unique number. Every intersecting polygons is unique group (see picture). So polygons have field "groups" with values: ...
4
votes
1answer
586 views

Find max and min values from a table based on two fields

I have a geodatabase table with the following fields: County_Name, State_Name, Date_Time, Customers Example Alameda, CA, 8/1/2014 12AM, 6 Alameda, CA, 8/1/2014 1AM, 1 Alameda, CA, 8/1/2014 2AM, ...
4
votes
2answers
470 views

How to get arcpy.da.walk to continue walk after encountering corrupt/problem file?

I am relatively new to python. I am trying to iterate through all DWG polylines in a directory with multiple (hundreds) of subdirectories. I would like the code to skip any DWG files that it cannot do ...
4
votes
1answer
365 views

How to cancel tool execution in python

I've written a python function that calls a tool (Import CAD to GDB) in a loop. When I run it I have seen that it hangs sometimes, and I have to force the script to quit. I am wondering if there is a ...
4
votes
1answer
740 views

Getting ArcPy autocomplete to work in IDLE?

I want to write scripts in IDLE, but I love how the built in python window in ArcGIS 10.2 automatically fills in the module names as you start typing them. For example, if I type arcpy.Lis..., the ...
4
votes
2answers
291 views

How to publish GP Service with importing of numpy in ArcGIS for Server 10.1?

I use a lot of scripts as GP Service almost all use the arcpy functions but one (and very important) of my scripts needs a gdal/ogr and numpy imports. I can run this script in PyScripter or as a tool ...
4
votes
1answer
295 views

Modifying script published as Geoprocessing Service in ArcGIS for Server?

In ArcGIS 10.1 before publishing script as a new GPService I have to run it in ArcMap. It is a good solution when I handle small amount of data. When I want to change something in my script I have to ...
4
votes
1answer
839 views

Problem: Arcpy Graph function empty graph output

Background: I have some python code that I need help with parameter passing into the MakeGraph_management arcpy function. I would like to create a two-series vertical line graph for every pair of ...
4
votes
2answers
929 views

How to replicate an unversioned SDE geodatabase to a file geodatabase?

I need to implement a process for creating a file geodatabase copy (a read-only snapshot, essentially) of a production SDE geodatabase without using versioning, adding global ID columns, etc. I cannot ...
4
votes
2answers
780 views

scratch files left behind by arcpy.sa.Con

I have a Con() statement that creates two "extra" scratch files during it's processing, but that do not get cleaned up once the operation is over and the output is saved. r=arcpy.sa.Con(elv, ...
4
votes
1answer
1k 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 ...
4
votes
3answers
1k views

Adding group layer, renaming it from folder name, then adding layers to it from that folder, using ArcPy/Python?

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 ...
4
votes
1answer
1k views

Why might Python Script be Crashing Inconsistently on ArcPy Batch LayerToKML script?

I put together a script to take a TIGER shapefile of all census tracts in a state, select the census tracts by each county, and export them into individual county-level kml files. The problem is that ...