Questions tagged [python-2.7]

Version 2.7 of the Python programming language

Filter by
Sorted by
Tagged with
2 votes
2 answers
250 views

ERROR 000732 - Dataset * does not exist or is not supported Failed to execute (CopyFeatures)

My main goal is to export a layer from ArcMap as a shapefile and upload it to AGOL. However, I am stuck at this intersection. All my scripts work in the python console within ArcMap. However, I cannot ...
user avatar
  • 23
0 votes
0 answers
13 views

QGIS and Python 2.7 - cannot find qgis installation at /usr despite qgis being installed

I am trying to install python library qmesh but it seems to have issues with python3 so I am attempting with python2.7. I've got qgis 3.2.2 installed but I am getting an error saying 'Could not find a ...
user avatar
  • 1
0 votes
1 answer
42 views

Inserting new point from XY Coordinates with field values using ArcPy

I am trying to add new point from table using XY coordinates fields to database. I can add point without fields, but when i try to add point with field values i can not do it. In SearchCursor ID is a ...
user avatar
1 vote
1 answer
86 views

Using relationship classes in ArcPy

Is there any way to use relationship classes with ArcPy to access associated records? The ArcGIS Idea for there to be An Arcpy method for dealing with related records leads me to believe that there is ...
user avatar
  • 54
0 votes
0 answers
58 views

arcpy.mapping.MapDocument("CURRENT") not working in sub thread

I want to create a customize tool in ArcMap by Python Add-in wizards.I found that arcpy.mapping.MapDocument("CURRENT") does not work in the sub thread. How can I call main thread to execute ...
user avatar
1 vote
3 answers
124 views

WFS layer saved as a shapefile

I wish to interrogate a WFS layer: 'https://environment.data.gov.uk/spatialdata/flood-map-for-planning-rivers-and-sea-flood-zone-2/wfs' I am not the greatest python programmer (not quick) but can do a ...
user avatar
0 votes
0 answers
462 views

Error when pip install -e geonode: Getting requirements to build wheel ... error

I am unsure as to where my current problem is, can someone please point me to my existing problem and possible solution. (geonode_env) C:\Users\amell\Documents>pip install -e geonode ...
user avatar
0 votes
0 answers
238 views

Why do images in Open CV template matching get matched to the templates more than once?

The following code reads the set of input tiff files under tiffile and template tiff files under files and performs template matching on them. After the image gets matched, opencv contour extracts the ...
user avatar
0 votes
1 answer
29 views

Receiving "unexpected error" after running script with ternary operator in ArcMap

I am using Python 2.7 and ArcMap 10.8. I made this script that will replace the datasource of particular layers in my "template" mxd and then save a copy of the mxd to a designated folder. I ...
user avatar
0 votes
0 answers
39 views

TableToTable (CSV to GDB) with WKT column

I have a CSV file with a WKT column with LINESTRINGS as geometry. How do I setup the call to TableToTable() in order to directly "transform" that WKT column to a shape/geometry column (while ...
user avatar
0 votes
0 answers
17 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 ...
user avatar
  • 369
0 votes
0 answers
106 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....
user avatar
  • 161
1 vote
0 answers
36 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')...
user avatar
  • 1,659
4 votes
1 answer
478 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 ...
user avatar
  • 1,154
1 vote
0 answers
60 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 ...
user avatar
  • 1,154
5 votes
2 answers
1k 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 an ESRI File Geodatabase(s). I want to list all the feature classes that are inside the GDBs that have ...
user avatar
0 votes
0 answers
50 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 ...
user avatar
  • 33
0 votes
1 answer
115 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....
user avatar
  • 17
1 vote
2 answers
171 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 ...
user avatar
0 votes
1 answer
510 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 ...
user avatar
1 vote
1 answer
65 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 ...
user avatar
0 votes
1 answer
64 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 ...
user avatar
0 votes
0 answers
54 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" ...
user avatar
  • 1
2 votes
0 answers
378 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 ...
user avatar
  • 105
2 votes
2 answers
527 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 '...
user avatar
  • 49
1 vote
1 answer
60 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.....
user avatar
0 votes
0 answers
36 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=...
user avatar
0 votes
1 answer
124 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 ...
user avatar
2 votes
0 answers
71 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 ...
user avatar
0 votes
0 answers
82 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 ...
user avatar
1 vote
0 answers
127 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 ...
user avatar
0 votes
0 answers
25 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 ...
user avatar
  • 1
0 votes
0 answers
338 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(...
user avatar
1 vote
0 answers
69 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 ...
user avatar
0 votes
1 answer
129 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 ...
user avatar
  • 1,659
1 vote
2 answers
179 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, ...
user avatar
  • 103
1 vote
0 answers
131 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 ...
user avatar
0 votes
0 answers
57 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 ...
user avatar
1 vote
0 answers
580 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 ...
user avatar
  • 11
1 vote
1 answer
228 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 ...
user avatar
  • 824
0 votes
0 answers
117 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 ...
user avatar
  • 1
1 vote
1 answer
207 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(...
user avatar
1 vote
2 answers
115 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 ...
user avatar
  • 25
1 vote
0 answers
29 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() ...
user avatar
1 vote
0 answers
68 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() ...
user avatar
0 votes
1 answer
52 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(...
user avatar
5 votes
1 answer
3k 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 ...
user avatar
  • 1,060
1 vote
1 answer
184 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 ...
user avatar
  • 1,659
0 votes
1 answer
289 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\...
user avatar
  • 1,659
1 vote
1 answer
122 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', '...
user avatar
  • 1,659

1
2 3 4 5
14