A site-package created by Esri to expose ArcObjects to Python.

learn more… | top users | synonyms (1)

4
votes
2answers
60 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 ...
0
votes
0answers
6 views

Replace data frame with arcpy

I work on arcview 10.3. How can i replace an existing data frame in mxd with another data frame by using arcpy?
2
votes
1answer
147 views

Is it possible to run a search cursor on a multipart feature class?

I have a multipart feature class of cities. I want to run a search cursor on a cities feature class where: one city is selected and a select layer by location is run to select all parcels that are ...
5
votes
3answers
1k views

calculating a field in which null values may be present

I would like to calculate a field (short integer) using other fields (short integer) present in the table. In some cases these fields may have null values for one or more of the fields. For example, ...
0
votes
1answer
39 views

buffering one feature class by different distance, the result is the buffer distance become same 100 feet

try: # Import modules import arcpy from arcpy import env # Set the workspace env.workspace = r"C:\Esripresspython\GISTPython\Data\City of Oleander.gdb" # Create a variable with the name of ...
2
votes
1answer
60 views

Correcting addresses with Python or Model Builder

I am trying to make a script in Python (or Model Builder in ArcGIS) for correcting addresses. I have a point shapefile with the addresses (it has X and Y, and fields for "number", "street name", and ...
4
votes
1answer
69 views

how to compare geometries (contains, within) in arcpy?

I am trying to use 2 geometry objects to check if a line is within a (rather complex) polygon. The geometry check always fails, even if the line is clearly within the polygon. I use the following ...
0
votes
1answer
31 views

How to generate histograms of multiple fields?

I have a large shapefile and I'm trying to automate a process to generate histograms of several fields with the MakeGraph tool, but I'm receiving the following error. class ...
0
votes
2answers
42 views

Optimizing script with in_memory selection

I had a problem solved here. I had 2 features: polygons and points, both containing similar attributes(example: street name, number). Each polygon must have equivalent point added(same street name, ...
6
votes
2answers
506 views

How to write scripts that can call on both Arcpy and PyQGIS?

I have spent quite a bit of time looking for a clear answer this topic and have still been unable to really accomplish my goal of accessing PyQGIS in a stand alone script. Parts of answers have been ...
3
votes
1answer
204 views

Exporting records from an attribute table and placing them in a txt file

I am trying desperately to grab records in a shapefile's attribute table and copy them, with additional formatting to a txt file. Below is the code I have developed thus far: I have used the ...
4
votes
1answer
45 views

How to add Attributes to a polygon with arcpy

I have a question about arcpy. I want to create a polygon FeatureClass with attributes. The code below is just test-code that generates some polygons for speed testing. I want to add some additional ...
5
votes
2answers
521 views

ArcGIS Conflation Tool Recommendation or Custom Script for Comparing Points

Can anyone recommend conflation tools for ArcGIS Desktop (10 or 10.1, paid or free) or a scripting outline / procedure (or just a script) to have a technician efficiently process the following rules? ...
2
votes
2answers
32 views

How to find number of synchronized records in ArcGIS10.2.2 (Data Management)

I want to find number of records synchronized while using arcpy.SynchronizeChanges_management tool. Right now, I'm getting only messages like process is Executing, Synchronize successfully ...
2
votes
0answers
49 views

How to get an ArcGIS custom tool to run fom the command line?

I have been experimenting with ESRI's CalculateArea custom tool and it works fine running within ArcGIS from a toolbox. Then I wanted to see if I could run it as a standalone script from the ...
2
votes
1answer
184 views

Using Python to connect to Multiple SDE Database Connections

I am writing a script that accesses multiple sde Database connections. I have set the script to include accessing the environment workspace: import arcpy arcpy.GetParameterAsText(0) ...
-2
votes
0answers
17 views

How to work data driven page with arcpy? [on hold]

Can somebody share any video or something how to work with data driven page with arcpy?
6
votes
2answers
800 views

Binding Objects to List for ArcGIS Python Script Tool Parameter?

I am working on a python based script/tool. I would like to make use of drop down lists for several of the parameters. This is very easy to do if the lists are just plain old strings. Does anyone ...
6
votes
1answer
400 views

Algorithm to fill the gaps adjacent to parcels

I would like to find a way to fill the gaps between the road and its surrounding parcels, like described in picture below: I have different parcels like A and B , i want to fill the gaps by adding ...
3
votes
1answer
1k 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
110 views

How to automatically generate least-cost paths between several polygons?

What is the fastest way to automatically generate least-cost paths (LCPs) between several polygons with ArcGIS ? I created a python program to do this by using the functions "CostDistance" and ...
-1
votes
1answer
36 views

Search layer in MXDs

I work on arcview 10.3 and i try to find layer called "ways" in several mxds. i try this code but it does not work. anyone know how to do it?: import arcpy,os,sys,string import arcpy.mapping from ...
2
votes
1answer
109 views

Optimizing arcpy script to batch generate OD cost matrix in road networks

Following the question I asked in this thread, I wrote a python script designed to compute an OD cost matrix given a road network and origins/destinations locations. I am completely new to python, so ...
4
votes
1answer
164 views

How can I exclude a field on a table from being copied?

I have a query "layer": >>> r = arcpy.MakeQueryLayer_management(r'C:\path\to\connection\file\connection.sde', 'TEST', 'SELECT T.ID AS OBJECTID, T.* FROM MY_TABLE T WHERE T.SOME_COLUMN = 1', ...
0
votes
1answer
34 views

limit spatial extent of arcpy cursor

How do I limit spatial extent of features that is returned by arcpy.da.SearchCursor? Can I use arcpy.env.extent? Or somehow come up with sql statement to specify spatial relationship? Or do I have ...
4
votes
2answers
62 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 ...
1
vote
1answer
257 views

arcpy symbology colors changing on RefreshActiveView()

I have a problem that I'm not sure is functionality not built into arcpy or I'm just doing something wrong. I'm using arcpy.mapping.UpdateLayer() to apply symbology to a layer, but afterwards some ...
0
votes
1answer
530 views

ArcPy SelectLayerByAttribute Error and how to control GP output layer name

I have a rather long script that first references an SDE feature class (non-versioned) to perform an attribute selection based on a SQL selection. I've been unable to figure out why the script will ...
7
votes
1answer
3k views

Use python to add layers to TOC

I've been battling with adding layers to the TOC for some time now. I have managed to single layers added but need to loop through a folder and add all layers. Shapefiles I cannot get to add at all. ...
1
vote
1answer
80 views

Calculate Date field in ArcPy

I'm trying to use arcpy.ExtractValuesToPoints() to get raster values to a points feature class for several raster files (8760). The goal is to get a time-slice view of how the values at certain ...
3
votes
1answer
357 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 ...
7
votes
3answers
1k views

Permanently replace/update server/service in each ArcSDE Layer in MXD?

Using the mxd.findAndReplaceWorkspacePaths method, if and MXD is updated and the path the the .sde connection file moves again all of the data sources will break again. Is there a method to ...
1
vote
1answer
48 views

How to checkin ( release, make it free) arcgis 10.2 desktop license using arcpy?

There is a way to do this using AcrGIS license Server Administrator, but I need a command to use it in arcpy scripting.
2
votes
1answer
75 views

Access ArcCatalog Window through ArcPY

I want to create a button in ArcCatalog that takes the metadata from the selected file in ArcCatalog and prints it to a text file. The metadata extraction part is done, and I have succssfully tested ...
2
votes
1answer
46 views

MakeFeatureLayer weird behavior from script

I am trying to add a feature layer to my map document as the output from my python script. The goal is to limit the number of fields in the attribute table to a pre-defined list. I am able to add ...
2
votes
2answers
30 views

Output raster from IDW interpolation tool is from 3.40282e+038 to -3.40282e+038 in ArcPy

I am not familiar with Python in ArcGIS, so I used ModelBuilder first to set the environment and put the tool in. The model worked right and the output raster seemed good. Then I exported the model ...
0
votes
1answer
56 views

UpdateLayer with arcpy

I am trying to use updatelayer in three mxd's. Each mxd has 3 data frames. I am getting an error, can anyone help? import arcpy,os,sys,string import arcpy.mapping from arcpy import env env.workspace ...
2
votes
1answer
29 views

Converting geographic units with ArcPy

I am trying to compare a set of point features to the centroid of a single feature polygon using ArcPy. The problem is that the polygon generates a set of XY coordinates in meters, whereas the set of ...
2
votes
2answers
53 views

List all feature layers

I will often create many temporary layer files with MakeFeatureLayer_management. I was wondering if there was a means to list the temporary layer files I've created. I've tried setting the workspace ...
0
votes
1answer
161 views

Spatial ETL Tools won't run “AttributeError: 'module' object has no attribute, etc.”

I have a python script that runs 5 Spatial ETL tools that I wish to run as a scheduled task. Each of the tools will run successfully from ArcCatalog and also from the ArcCatalog Command line. If I ...
2
votes
2answers
77 views

Populate a layout text element with the description from a coded value domain

ArcGIS 10.1+ lets you easily put dynamically populated text boxes in your print layouts. Doing so puts some text in the text element that looks something like this: <dyn type="page" ...
1
vote
4answers
64 views

NameError: variable not defined even though set multiple times

This code original worked when run through the python command window in ArcCatalog. After I added the script to a toolbox I have had all sorts of troubles. The most frustrating error has been: ...
0
votes
0answers
50 views

How to check out arcgis 10.2 desktop license using arcpy?

Referring to ArcGIS help it seems possible to check out advanced desktop license. But typing arcpy.CheckOutExtension('ArcInfo') gives Unrecognized extension code ArcInfo
3
votes
1answer
171 views

No placement inside feature dataset using arcpy XYtoLine?

When I run the following code with the outFC creation path set to a feature dataset inside a file geodatabase... arcpy.XYToLine_management(tempFC, outFC, "POINT_X", "POINT_Y", "NEAR_X", "NEAR_Y", ...
2
votes
1answer
101 views

Is there a way to set the workspace on selected features

i´ve built in a tool for arccatalog which transfers GIS Files into shape Files. Everything is working so far, but i want it a bit more customer friendly. Atm it looks like this: You can right click ...
1
vote
0answers
19 views

Upgrade Geodatabase crashes python and ArcCatalog

We are currently in the process of upgrading our ArcGIS for Server license (10.0 to 10.2.2) and our SQL Server instance from 2008 (SQL Express) to 2012 (Full blown). We have around 60 databases to ...
2
votes
3answers
1k views

Adding shapefile as layer in ArcMap via Python scripting?

I am trying to automate various tasks in ArcGIS Desktop (using ArcMap generally) with Python, and I keep needing a way to add a shapefile to the current map. (And then do stuff to it, but that's ...
0
votes
0answers
24 views

Error changing version using ArcPy, produced from escape character in version name

I've got a script which creates a version from BASE, appends a feature to a dataset and then reconciles/posts. It runs successfully when I use a different SDE connection that doesn't have a backslash, ...
1
vote
1answer
35 views

Calculating centroid latitude in ArcMap throws error in Arcpy

I can create a centroid latitude field in ArcMap10.1 using "Calculate Geometry..." in the attribute table, but when I try the same thing using: arcpy.CalculateField_management(bins_WGS84, "cent_lat", ...
2
votes
2answers
55 views

How to print selected page from Data Driven Pages using ArcPy?

I am looking to print DDP (Data Driven Pages) to a printer through a Python (arcpy) script which I will create in Arc Catalog. In other words, I would like for the script to have the following ...