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

learn more… | top users | synonyms (1)

3
votes
2answers
3k views

Customizing label features using arcpy

I have a script that creates symbology for a polyline (contours) and then adds it to a .mxd file. My problem is that it picks the “FontName” as the default field to label on the map (see attached ...
3
votes
1answer
1k views

Sorting shapefile records on attribute to update new rank field using Python?

Basically, I am trying to sort the records within the shapefile based on an attribute(eg: pop) and then add a new field that indicates ranking based on the sort. eg: the record with the highest pop ...
3
votes
3answers
3k views

Geoprocessing with ArcGIS Server 10.0 - %scratchworkspace%

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Key_concepts_for_geoprocessing_services/002v00000002000000/ I'm trying to have a new GP Service arcpy.AddMessage() the scratchworkspace ...
3
votes
2answers
1k views

Is it possible to get arcpy on 9.3* or Qgis? Or maybe some of the functions?

If this isn't possible what would be the closest equivalent open source? Could parts of the module be ported to work on 9.3 or QGIS? I'm not sure if this would infringe on the license porting for 9.3. ...
3
votes
1answer
119 views

Checking .mxd version using ArcPy?

I am looking for a way to check the mxd version of a bunch of mxds. I found a script here at ArcPy method to determine ArcMap document version I am using ArcGIS 10.3.1 on my desktop. It goes through ...
3
votes
1answer
120 views

Is there a quick way to see the fields in a table via arcpy?

I frequently find myself in Python debug mode, trying to examine the fields of a layer or table. arcpy.Describe(lyr).fields returns an array of <geoprocessing describe field object> which isn't ...
3
votes
1answer
83 views

Using arcpy to find geometry within another feature

In Arcpy, I would like to start with a point and then using its geometry method to find out if it is inside my polygon feature (Urban Areas) deeper than the buffer distance. This is a follow up to ...
3
votes
4answers
113 views

Python Script create spreadsheet with exception

In the following Python Script, I would like to create a spreadsheet (Excel would be fine) with the Exception results instead of just printing "There was an error--->..." to be able to keep track of ...
3
votes
2answers
525 views

How to calculate a value based on another field under arcpy.da.UpdateCursor and cursor.updateRow?

I am trying to do a calculations under arcpy.da.UpdateCursor. I want to calculate the values for the records that have FIPS=06037. I want to take the values from "kg" column and populate the new value ...
3
votes
2answers
228 views

Finding the Python script used by a custom toolbar button in ArcMap

I've been asked by somebody at work to design a toolbar add-in that works just the same as an existing one, but with a different set of data. However, the person who wrote the original add-in for him ...
3
votes
1answer
131 views

ArcPy delete terrain: cannot be deleted

I can't get my ArcPy script to delete a terrain. If it exists, it should be deleted. However it throws an ERROR 000317: {path} cannot be deleted My script is a lot longer than this, but this ...
3
votes
2answers
169 views

Calculate field values using random integer derived from count of like features

I have a feature class which contains features classified by type. What I would like to do in my new field is generate a random number sequence for those like values using a count of the like values. ...
3
votes
1answer
63 views

Does Avenue equivalent of pointPosition exist in ArcGIS 10.2?

There were a couple of awesome methods in Avenue for ArcView: point=polyline.Along(percentage) percentage=polyLine.pointPosition(point) Don't laugh, but one of the reasons I updated to 10 from 9, ...
3
votes
1answer
234 views

ArcPy / ArcMap 10.2: How to report data to user?

I'm developing an arcpy addin with ArcMap 10.2 that outputs a feature layer based on user input. How can I display attributes from this layer in a MessageBox or other reporting mechanism? I don't ...
3
votes
1answer
260 views

AddJoin failing in Python ArcGIS [duplicate]

My AddJoin operation is failing: arcpy.CopyRows_management(lup_file,out_dir+'lup') try: # Perform copy rows on merged csv file print 'start' aa = arcpy.Raster(SEIMF) ...
3
votes
3answers
884 views

Why does import arcview/arceditor give gp.setProduct() RuntimeError: ERROR 999999: Error executing?

I am developing a script that will be used in ArcGIS Desktop 10.2 of Standard (formerly called ArcEditor) license level and thus importing arceditor to make sure I don't use GP tools that require ...
3
votes
1answer
380 views

Using update cursor in a while loop to perform analysis on individual polygons gets stuck on first row

I am working through an open courseware project from PSU found at https://www.e-education.psu.edu/geog485/node/145 I am trying to use an update cursor in a while loop to perform an analysis on ...
3
votes
1answer
73 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 ...
3
votes
1answer
701 views

How to convert all shapefiles in folder into KML using ArcPy?

I was trying to convert all the shp in a folder into kml. featureclasses = arcpy.ListFeatureClasses() for fc in featureclasses: # Set Local Variables composite = 'COMPOSITE' pixels = ...
3
votes
2answers
147 views

Should Python Add-In installed in map which is packaged be part of *.mpk?

Using ArcGIS for Desktop 10.1 SP1, I just created a map package (.mpk) from a map (.mxd) which had a Python Add-In (.esriaddin) installed. When I unpacked the .mpk the .esriaddin was neither ...
3
votes
2answers
1k 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 ...
3
votes
2answers
564 views

ERROR 000840: The value is not a Raster|Raster Catalog|Mosaic Layer from arcpy.AddJoin_management()?

I am doing some arcpy -functions and afterwards I'm trying to add the calculated results from one table to another table. I'm using the arcpy.AddJoin_management() function. As input table I'm using ...
3
votes
1answer
729 views

Getting unicode encode error in ArcPy/Python script?

When I am running a script (it checks to which database a mxd is connected) I get the following error: return codecs.charmap_encode(input,errors,encoding_table) UnicodeEncodeError: 'charmap' codec ...
3
votes
1answer
220 views

Debugging TypeError: SearchCursor() got unexpected keyword argument in ArcPy script?

I tried to use SearchCursor(points, fields=fieldname) but I get this error: TypeError: SearchCursor() got an unexpected keyword argument 'fields' I'm not sure why this doesn't work. # Local ...
3
votes
2answers
794 views

How to filter out multipart polygons and then buffer?

I've written a small script trying to accomplish the task described in the question title. It basically looks like: in_fc = '...' # Some shapefile goes here # Get the fields (column names) of the ...
3
votes
2answers
4k views

How do I use python to batch process the reprojection of a group of shapefiles?

My client would like his shapefiles reprojected and I would like to get a script that can batch process all the files located in the same folder. I am new to Python and ArcPy but am very interested. ...
3
votes
3answers
2k views

How do I access a multivalue output parameter from a python script in modelbuilder in ArcGIS 10.0?

How do I access a multivalue output parameter from a python script in modelbuilder, in ArcGIS 10.0? That is, I have a python script that loops through several input layers (working through a script ...
3
votes
1answer
1k views

ArcPy: Feature class “doesn't exist” after MakeFeatureLayer

I was working on a Python script to analyze the geometries of a feature class and write something out. It worked fine the first time, but gave an IOError each subsequent time. I narrowed the problem ...
3
votes
2answers
3k views

Selecting features through arcpy

I would like to achieve the following functionality through arcpy: Querying an existing baselayer on time and create a new layer Apply symbology from an existing layer and add the new layer to the ...
3
votes
1answer
695 views

ArcGIS Select Analysis using Unique Values from Field

I am trying to create separate shapefile using Select analysis with ArcPy by doing an SQL query to create them based on a unique value from the field. I want to create a list of the unique values in ...
3
votes
1answer
1k views

How to change the datasource with python?

How do I change the datasource of all layers in a map document using arcpy and python
3
votes
1answer
104 views

How do I import specific fields from a shapefile?

Using arcpy, how do I import only select fields from a shapefile? Or, if I must import the entire shapefile, how do I delete certain fields after import?
3
votes
3answers
169 views

Error when Projecting Rasters using ArcPy?

Using ArcGIS 10.3 I'm receiving the dreaded 'ERROR 999999' when attempting to project a geodatabase full of rasters from WGS84_UTM_zone_10N to Nad83_BC_Environment_Albers import arcpy InRasterGDB = ...
3
votes
2answers
122 views

Adding descriptions to feature class in a geodatabase using arcpy

I am trying to populate the properties of a feature class in a geodatabase using arcpy. In the past I have been given geodatabases with features classes that already have their property descriptions ...
3
votes
2answers
632 views

ArcPy Data Access Insert Cursor not writing geometries to feature class?

I'm running ArcGIS 10.2.1 and am having troubles with the Insert Cursor in the arcpy module. I have an empty feature class in my geodatabase and have created the short script below to try and find the ...
3
votes
2answers
166 views

Importing external bookmark (.dat) files into many MXDs using arcpy?

Does anyone know any python script to use for arcview to import a bookmark (saved as a .dat) that was created and saved externally using ArcMap? I tried with this script but without a result: import ...
3
votes
1answer
275 views

Project point to map with Arcpy using GPS Coordinates

I am trying to create a new layer with just a single point using arcpy. All that is provided is a gps lat and long. It seems like it should be a simple problem but I just can't get it to work. I've ...
3
votes
1answer
240 views

Converting Coverage files into shapefiles?

I am attempting to convert coverage files into shapefiles using arcpy. This is not the e00 files, but the bin files. ArcGIS help suggests that it can be done using ...
3
votes
2answers
1k views

How do I know if I am running 64-bit background geoprocessing on ArcMap 10.2?

I'm running ArcMap 10.2 and just set up 'ArcGIS for Desktop Background Geoprocessing (64 bit)' and now I have both the ArcGIS10.2 folder and ArcGISx6410.2 folder inside my python folder. I have ...
3
votes
2answers
932 views

Converting Vertices of Polylines and Polygons to Points and Maintain Attributes

I'm pretty sure someone has done this before, but I'm having no luck. I'm using ArcGIS Standard version 10.2.1 and I want to convert all the vertices of a polyline or polygon to points. Essentially, ...
3
votes
1answer
263 views

*.lyr to *.style conversion in ArcGIS

Do you know how it's possible to convert a layer symbology or an *.Lyr file to an *.style file? Thanks, Jérôme
3
votes
1answer
715 views

Edit SQL Server table (not registered with geodatabase) with arcpy

I am trying to update some rows in a SQL Server database table (not registered with geodatabase) with arcpy.da.UpdateCursor. However, when running the deleteRow(), I get the error return without ...
3
votes
1answer
1k views

How do I get the coordinates of my data frame always in long/lat?

I want to determine the coordinates of my current data frame. To do so I wrote this script: def DataFrame (): mxd = arcpy.mapping.MapDocument("CURRENT") df = ...
3
votes
2answers
949 views

Python script to read coordinate system of an input feature class? [duplicate]

How to read the coordinate system of an input feature class in python script. How we can use "Describe()" function and tool validator for that purpose
3
votes
2answers
251 views

Detecting ring direction of a polygon using ArcPy

I am using ArcPy in ArcGIS 10.1 to process some geometry using the arcpy.da data access module. However I have run into a problem with complex Polygons that contain inner rings/holes. From the ...
3
votes
2answers
2k views

How to save currently opened mxd and changes using ArcPy and Python?

Here is what I have so far... import arcpy import arcpy.mapping as map mxd = map.MapDocument() mxd.save() And yes I know that map.MapDocument requires an argument, but I want it to automatically ...
3
votes
2answers
608 views

What causes RuntimeError: ERROR 010240 saving after CellStatistics?

I am having trouble saving outputs from CellStatistics but only when I run it on a list of rasters. This was working on python 26 but not 27. I know this example is nonsense, but: env.workspace = ...
3
votes
1answer
296 views

How can I validate a table name on SDE with Oracle backend?

Second title: "Is arcpy.ValidateTableName broken on Oracle?" I have an Oracle SDE database 9.3.1 (service connection). My arcGIS client tools are version 10.0 SP5). I have some names of feature ...
3
votes
2answers
884 views

Using Select By Location to update field in feature class using ArcPy?

I am using Arc 10.1 and I am working on a script that takes a value from a field within one shape file and updates a field in another shape file based on its location. Basically I have smaller parcels ...
3
votes
1answer
882 views

Help with Python script for exporting mxds into pdfs!

I have written a python script to export my mxd into a pdf (not using data driven pages). I am getting the error that my mxd path is incorrect! I have included my script below. Any help would be ...