Questions tagged [python-2.7]

Version 2.7 of the Python programming language

Filter by
Sorted by
Tagged with
0
votes
0answers
14 views

Calling help for ArcPy function from within IDE

In IDLE (for Python v2.7.2 within my ESRI path), when I type: help(arcpy.gp.Slope_sa) I get: Help on function <lambda> in module arcpy.geoprocessing._base: <lambda> lambda *args which ...
0
votes
0answers
41 views

Why does my “Export to CAD” script work in Python 3.7, but not in 2.7?

I've written a script that iterates through all feature classes in a dataset in a geodatabase and writes them to separate dwg-files. In this case 230 feature classes. If I run the script in Python 2.7....
1
vote
0answers
31 views

Adding an incrementor in CalculateField_managment() expression

I am trying to recalculate a value for a field using arcpy.CalculateField_management() using a tricky expression. Currently, I am recalculating one field named REACH_ID, using another field ('CO_FIPS')...
4
votes
1answer
98 views

Python - Correct way of closing ogr.DataSource() objects

I learned that I need to close objects that I open, usually using a with open(): statement that does the closing for you after leaving it. With GDAL/OGR, this does not work and objects must be closed ...
1
vote
0answers
38 views

Speed up zonal statistics with additional calculation

I have two rasters, one is a classified image and the other the corresponding probabilities for a correct classification. Now I need to calculate zonal statistics for polygon segments in the following ...
5
votes
2answers
312 views

Get feature class names inside Esri file geodatabase

I have a project folder with many many folders within that. Some of these child folders contain a Esri .gdb file geodatabase. I want to list all the feature classes that are inside the GDBs that have ...
0
votes
0answers
43 views

Adding tool from Python script

I am trying to add Python script as a tool in ArcMap 10.6. I have the result or outcop3 saved in the folder Outputs. I added a output folder in the parameter and made the direction as output but i am ...
0
votes
1answer
50 views

Removing empty dataset from gdb

I want to delete about 25 datasets that are empty from my gdb file which consists 30 datasets. I am invoking pPthon window and trying to execute this script: import arcpy from arcpy import env env....
1
vote
2answers
110 views

Extracting values of some columns with ArcPy

I've been trying to run some code to extract the values from a column and random sample some of them. The problem is when I try to append values from the cursor to a list. When I append values to the ...
0
votes
1answer
207 views

Cannot use “CalculateGeometryAttributes_management()” tool to calculate the centroids of features with Arcpy

I've been trying to run some code in Python with ArcPy library. Everything is working fine, but in the end of the code there is a part that I want to calculate the centroids, x and y, with ...
1
vote
1answer
25 views

Cannot generate subsets of feature class with arcpy (ArcGIS library in Python 2.7)

I'm having a hard time here on processing GIS data in Python, using library arcpy. I've been trying to generate independent features from a feature class based on a field of the attribute table which ...
0
votes
1answer
56 views

Python 2.7 stand alone script for compounded with statement. Errors 'column specified does not exist - but it does

I'm writing a standalone Python script to use for labeling ArcMap 10.7 data. (Want to avoid label expressions for portability, etc). I'm attempting to use ID attribute to label based on ADMIN_ORG ...
0
votes
0answers
48 views

How do I assign values of a field, to another empty field when a conditional statement pertaining to a third field is considered?

When I run the code below I don't get the output I'm seeking. The "max_proportion" field is assigned the text LEVELMEAN instead of the values for each row within the "LEVELMEAN" ...
2
votes
0answers
200 views

.exe Packaging for Python files with ArcPy?

I've written a little program that's meant to function as a stand-alone, not as an add-in. I'd like to be able to pack it up as an .exe, rather than ask my users to run the script. It does import ...
0
votes
0answers
35 views

How to pass multiple values from one sample to nc variable?

I am using the following script to write the date and the snow cover values from each of the 258 files into a single NetCDF file. But python is not letting me add these for some reason. The code is ...
2
votes
2answers
139 views

Cannot calculate length of roads

I would like to calculate the lenght(km) of each line in shapefile of roads in a study area. I tried to use "Calculate Geometry" but it doesn't work! I cannot select 'Units', and 'Property' for '...
1
vote
1answer
42 views

Invalid Syntax on Update Cursor update

I'm using a dictionary created by a search cursor from one feature class to update another feature class with an update cursor. I'm getting an invalid syntax error for the cursor.updateRow(row) and.....
1
vote
1answer
52 views

Multiprocessing ERROR 000210 Cannot create output 'name' Failed to execute Intersect

I am trying to use multiprocessing to process intersects between polygons and points for a list of states and territories (the data sets for the points are large, so my hope was that the ...
0
votes
0answers
26 views

Create a loop to run and store the r.stats output of several viewsheds?

I have 15 viewsheds (view 0-14) from which I would like to export the cell count. I can do this for one viewshed through: count=[] i=0 viewshedSize=grass.read_command("r.stats", overwrite=True,flags=...
0
votes
1answer
53 views

Adding multiple fields for multiple feature classes in a single geodatabase

I am trying to add multiple fields to a list of feature classes in a geodatabase for NextGEN911. I am having trouble executing this line of code because I am getting the following error #Import ...
2
votes
0answers
29 views

Determining raster points inside polygon

I am trying to perform zonal statistics on a input DEM and a polygon shapefile using ArcPy in Python 2.7. I have done this in Python 3, but want to be able to do it using ArcPy tools in Python 2.7. So ...
0
votes
0answers
59 views

No response from addPart operation when trying to upload parts of .tpk to AGOL (Python, requests, ArcGIS REST API)

Trying to automate the updating of a large .tpk on AGOL. When the .tpk is updated on my servers I do the following: Break into parts Call updateItem operation with multipart = true Make a request to ...
1
vote
0answers
78 views

ArcPy for loops increase duration with each iteration

I am running an ArcPy script with IDLE 2.7 For each line in a geometric network, it traces the path to a fixed location from that input line. For each input line, it does this trace with all other ...
0
votes
0answers
19 views

Get the count of no. of polygons after intersecting shapefiles

There are 2 shapefiles: 1. A polygon shapefile 2. Grid shapefile(which needed to be run in a loop) Need to intersect the above 2 shapefiles and to get the count of no. of intersected polygons(which ...
0
votes
0answers
200 views

Handling nodata values in raster in Python

I would like to set value of raster -999.0 as NaN in crop_image function, while reading/cropping file: for band_path in range_bands: # open raster as numpy array by rater.io in content manager(...
0
votes
0answers
55 views

Extract related tables of a feature class to excel?

I have a feature class and a bunch of table connected to each other with relationships (please see the scheme of them down below). My goal is to extract the attribute table of fc as well as all ...
1
vote
0answers
42 views

Translating OMI(AURA) HDF5 To GeoTIFF?

I have omi (aura satellite) level 2 data sets for the aerosol product in he5 file format. Now I want to read that he5 file and save it as geotiff format in python. Could you help me anyone regarding ...
0
votes
1answer
77 views

Can an input be the same as the target with arcpy.Append?

I am basically trying to append the records of one feature class to another using arcpy.Append_management. They have similar but different schemas (they both have a uniqueid column but they also have ...
1
vote
2answers
89 views

Delete duplicate records from feature class in Python

I saw some examples with for loop to find duplicates. I had 1.5 million records in feature class, what would be fastest way to find duplicates and delete that particular rows. Based on three fields, ...
1
vote
0answers
78 views

Listing items using QGIS combo box from PostgreSQL

I am building a plugin for QGIS which will have a combo box listing data from PostGreSQL. I have already connected PostGreSQL. Now I would want to make this a plugin and add the list of jobs to the ...
0
votes
0answers
37 views

Alternatives to ArcGIS' “RegionGroup” a raster

I'm using the ArcGIS Python 2.7 interpreter in my PyCharm as I need several algorithms of the ArcPy package. However, I am having trouble with the RegionGroup of ArcGIS 10.7, as it sometimes crashes ...
1
vote
0answers
432 views

Displaying projection with IMSHOW()

I am having an issue displaying satellite data on the correctly projection using cartopy and imshow. I am unsure of the initial data projection, but I am trying to put it into Plate Carree with a ...
1
vote
1answer
120 views

How to disconnect a feature from Geometric Network using Python ArcGIS

I am creating a Python add-in for ArcMap, which on click, will disconnect the feature from Geometric Network and then delete it from the feature class. But ArcPy doesn't have any method to disconnect ...
0
votes
0answers
104 views

Import error with Mapnik in Anaconda 2

I'm using Anaconda to write geographic programs, so I need to use packages like Mapnik. After installing Mapnik in Anaconda2, it started to error. First about Mapnik itself and after do some actions ...
1
vote
1answer
118 views

Remove layer assertion error

I am using below code to remove any layer if it has zero features in it. mxd = arcpy.mapping.MapDocument("CURRENT") aDF = mxd.activeDataFrame namE = ["No_Work_Done"] if int(arcpy.GetCount_management(...
1
vote
2answers
49 views

ArcPy Tool Validator error with defined parameter value

I am using ArcMap 10.3.1. I have two parameters for my script tool. The first is the type of product to be created, the second is the scale of the product. Digital Map / No scale required are the ...
1
vote
0answers
27 views

Getting (0,0) instead of the intersecting co-ordinates value

This code works below fine when line(The Circle I mean) intersects more than two new lines but fails when both the intersection falls in the middle of the same line polygon_path = iface.activeLayer() ...
1
vote
0answers
48 views

Renaming pre-existing table Field name using PyQGIS

I am using PyQGIS with QGIS 2.84. This is the code I have used: layer = iface.activeLayer() parking_layer_field_names = [str(i.name()) for i in point_layer3.pendingFields()] layer.startEditing() ...
0
votes
1answer
44 views

Run code on pressing a key in Pythonaddins

I tried making an addin having below code where I want the user to press a predefined key and the "required_code" should run on the selected features. import arcpy import pythonaddins class Key1(...
5
votes
1answer
2k views

Unable to install plugins in QGIS 3.10 for Mac. No python support detected

I'm aware this question has already been asked numerous times in various forms, but I'm not finding any solutions that work for me. "No python support detected" in QGIS. Issue: Tried: 1. Updating ...
1
vote
1answer
103 views

Why will arcpy.Project_management not create output?

I have 2 feature datasets in a .gdb (CNMS_Inventory and CNMS_Inventory_Albers). I set the dataset for CNMS_Inventory to 4269(NAD83) when I created it and it contains a feature class called ...
0
votes
1answer
117 views

Applying field mapping during Merge using ArcPy

I am trying to merge 10 stream feature classes together using arcpy. But I need to limit the number of fields in the output (all feature classes share the same fields). working_dir = r"C:\Projects\...
1
vote
1answer
71 views

How to specify fields to use in a merge

I am using arcpy to merge multiple feature classes from a list of feature classes. They all have the same fields. Let's say they all have the fields = ['CO_FIPS', 'MILES', 'FLOOD_ZONE', 'VALID', '...
2
votes
1answer
98 views

Calling a Class from Another Within a Python Toolbox

Using the example below, both ToolOne and ToolTwo have two parameters each, and are independent functions in their own right, but also form the basis for a chain of functions for an output. I am ...
0
votes
1answer
36 views

ArcPy to select by location not showing selected features in attribute table

I have a button where it first calculate no of features in a specific layer and then runs the "are_identical_to" and update "D". After that it checks if the no of counts in two layers is same? If not, ...
0
votes
1answer
53 views

Combobox value increment and update

I have made a custom add-in for my building ID update tool. The objective is: user will write an alphanumeric value in the combobox like 'x100'. When a user selects a bunch of polygons(building) and ...
1
vote
0answers
50 views

My UpdateCursor is not working. The attribute table of my new shapefile is not updating [closed]

I am new to arcpy. I am trying to do a few things with a shapefile. First I created a new shapefile with specific dataset that I wanted to work on. So far everything works until the UpdateCursor. When ...
4
votes
1answer
79 views

Not able to update the “ACTION” field

Currently I am working on a GIS project where I have to update a field in a layer with some values to get my work done. Because the manual efforts are time consuming hence I added a custom addin to my ...
0
votes
3answers
91 views

How to access/manipulate a feature class/dataset in a personal database by using cursor via ArcPy?

I wrote an ArcPy script which uses cursors and it works fine with shapefiles. However, it does not work if I execute the same thing in a personal geodatabase. Should I use different format for a ...
0
votes
1answer
60 views

Finding intersection point between two arcs? [closed]

I am trying to find the intersection between two arcs. I have done this for line segments using shapely package. Does anyone have any advice?

1
2 3 4 5
14