Quantcast
Channel: Question and Answer » arcpy
Browsing all 767 articles
Browse latest View live

PySAL natural breaks from Numpy array

I am attempting to extract natural break values from a raster using Python. The intended process goes: Arcpy raster object to NumPy Array (using RasterToNumPyArray) to natural break values (using PySAL...

View Article


Including NoData zones in zonal statistics table

I am running the zonal statistic tool on a raster with a shapefile that consists of several regional polygons. I would like the zonal statistic to include the regions that are completely NoData in the...

View Article


How do I make arcpy exclude frozen / off layers while importing a DWG file?

I’m attempting to update existing GIS feature classes (SDE) using master AutoCAD files but end up importing ALL features present in the AutoCAD drawing regardless of the visibility settings (frozen /...

View Article

Image may be NSFW.
Clik here to view.

Multivalue input from a chosen field gives patchy inputs strings

I made a small tool that can be run from a toolbox. It has a validation code to choose multiple values from a specified field from a specified feature layer. It looks quite ordinary: The validation...

View Article

Image may be NSFW.
Clik here to view.

Why does arcpy.da.SearchCursor() class not autocomplete within Eclipse?

I am very new to GIS. I just installed eclipse luna with pydev plug-in and ArcGIS 10.1 for Desktop. When I write a script, trying to import arcpy.da.SearchCursor I see that no SearchCursor is available...

View Article


How I can do event with two clicks using python add-in wizard?

How I can do event with two clicks using python add-in wizard, I have found a way to do event with one click by adding a New Tool in the wizard, but I need “first click To copy the attributes from the...

View Article

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...

View Article

Image may be NSFW.
Clik here to view.

Changing order of parts in multipart geometry using ArcGIS for Desktop (or...

Is it possible in ArcGIS to change order of the parts in multipart geometry? In the context menu i founded “insert before” , “insert after” but it never comes active … or is it possible via python?

View Article


arcpy calculate string field: Any ideas what how to fix this?

I’m trying to store a string value obtained from a loop through a tuple into a field called ROW_1. The code goes like this: for creekclass in listOfClassTuples: (classname, Permanency, creekWidth,...

View Article


Image may be NSFW.
Clik here to view.

ArcPy Slope Script – Trouble Saving

I have an ArcPy script that applies the slope function to raster files in ArcGIS. I tried running the script with two raster files in the table of contents, and the script runs, but only saves one...

View Article

Trying to preserve attributes using SearchCursor

I am writing a python script for ArcGIS. I’m fairly new to this so I hope I’m not missing something very obvious. I am having trouble preserving the attributes of a polyline feature class when...

View Article

ArcPy SearchCursor getValue leads to NoneType object has no attribute lstrip?

I am having a little bit of a dilemma. I am having a problem with using getValue() and striping the value that is returned. For instance, take the following code. import arcpy as ap mxd =...

View Article

How to change field defined as REQUIRED to NON_REQUIRED in ArcGIS Geodatabase

I have created some feature classes in a geodatabase and also some fields using this sample code: arcpy.AddField_management("schools", "ref_ID", "LONG", 9, "", "", "refcode", "NULLABLE", "REQUIRED")...

View Article


Tools/Software for QA/QC of data

I currently have written a few custom scripts that run basic checks (null values, geocoding errors, fullness of metadata) using Arcpy(10.2 with almost all licenses) and gdal. I’m interested to know if...

View Article

Track progress of running GP tools (in arcpy script) programmatically?

I am looking for a way to access a GP tool running in a Python script to be able to see how much of the job has already been done. I have found SetProgressor function, but this one is available only...

View Article


Delete Files in a folder and disregard an existing folder

I did a lot of geoprocessing steps and now I like to delete all files including result, result, _join, _interand reclass in their name. I can do this with the following import glob import os for fl in...

View Article

Arcpy and pyqgis on same IDE

I have question: is it possible to set up arcpy and pyqgis on the same IDE (I use Pycharm). I have some problem with running my pyqgis scripts from pycharm. When I first configure Pycharm to recognize...

View Article


SQL-query in arcpy – SELECT WHERE feature between two values

I need to select features between two values in python with arcpy. However, whenever I try to run the code below, it returns with error message “An invalid SQL statement was used”. whereclause = """"X"...

View Article

Problem writing list of features to text file

I am attempting to write / run a simple script that list all the points within a directory, and the subdirectories contained within. Here is the code: import arcpy, os workspace =...

View Article

Randomly assign a value to a specificed number of rows in a feature class in...

I have several feature classes, each with a million or so rows. In each of these feature classes I have an attribute (“STATE”), the value of which I want to randomly assign to one or another state (so...

View Article
Browsing all 767 articles
Browse latest View live