Questions tagged [python-2.7]
Version 2.7 of the Python programming language
696
questions
-1
votes
1
answer
27
views
Why do I get an error message while loading and generating a file on ArcGIS Toolbox? [closed]
Why do I get an error message while loading and generating a file on ArcGIS Toolbox? I have attached a picture of the problem below
3
votes
1
answer
135
views
Clean polygons by shape type
I have a map on QGIS that looks like this:
I would like to clean the weird-looking polygons (inside a red circle for example) and keep the normal-looking ones. My initial approach was to compute the ...
0
votes
0
answers
24
views
Apply continuum removal to all pixels of an arbitrarily large hyperspectral image in Python
I need to implement continuum removal for ENVI hyperspectral images in an ArcMap Python Toolbox. Thus, I am limited to Python 2.7.16 functions and basic ArcMap tools. Additionally, I have the Python ...
0
votes
0
answers
186
views
Python Esri ArcPy functions do not work properly in command prompt but it works properly in PyScripter IDE
I have a simple Python script that imports the arcpy module. It works quite perfect in ArcMap's Python Window and PyScripter IDE but in the Command Prompt console some functions like arcpy....
0
votes
1
answer
30
views
How to change eps float value to geographic meter distance
I have a problem in making distance meter parameters for the DBSCAN tool. The problem is that I don't know the eps unit to use and how to change it to meters to be a parameter. Here's the Python ...
1
vote
1
answer
16
views
Python Script Failure to add derived shapefile to current map document
I'm trying to do some work using Python 2.7 and ArcGIS Desktop 10.7.1 - I know old software. For some reason that I cannot figure out, my script adds the derived featureclass / shapefile and then ...
0
votes
0
answers
26
views
ArcMap stops working when I click on add-in ArcMap [duplicate]
First creating the form with a tkinter. as in the code below.
# -*- coding: utf-8 -*-
import tkinter as tk
import tkinter.font as tkFont
from tkinter.ttk import Combobox
class RestServis:
def ...
0
votes
1
answer
26
views
GRASS addon r.tg.grom throwing a Python error
I'm trying to get this addon to run in GRASS to calculate Topographic Grain for my DEM. I've managed to get it installed and functional on GRASS 7.6 on macOS 12.2.1, but after inputting my parameters ...
0
votes
1
answer
111
views
Script won't iterate through text files in folder
Would anyone be able to tell me why the script won't iterate through each text file? The script runs successfully (Python 2.7), but does not populate GasLines_Final polyline feature class with ...
2
votes
2
answers
711
views
Draw a normal from a point to a line
How to draw a normal LineString (AB) to existing LineString (CDEF) from a given Point (A)?
Shapely version == 1.5.16
1
vote
0
answers
68
views
Create coordinate polygon without azimuth
I'm trying to create a GeoTIFF bitmap from coordinates and data, the coordinates are given as a list and the data is in a saw list of lists. Now I create a polygon of coordinates using the haversine ...
2
votes
2
answers
4k
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 ...
0
votes
0
answers
35
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 ...
0
votes
1
answer
228
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 ...
1
vote
1
answer
322
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 ...
0
votes
0
answers
83
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 ...
1
vote
3
answers
616
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 ...
0
votes
0
answers
586
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
...
0
votes
1
answer
38
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 ...
0
votes
0
answers
116
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 ...
0
votes
0
answers
22
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
0
answers
201
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
0
answers
38
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')...
6
votes
1
answer
1k
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
0
answers
173
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
2
answers
3k
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 ...
0
votes
0
answers
67
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
1
answer
276
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
2
answers
363
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
1
answer
689
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
1
answer
112
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
1
answer
76
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 ...
2
votes
0
answers
579
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 ...
2
votes
2
answers
1k
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
1
answer
130
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.....
0
votes
0
answers
42
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
1
answer
199
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
0
answers
114
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
1
answer
141
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
0
answers
218
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
0
answers
30
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
0
answers
655
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(...
1
vote
0
answers
89
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
1
answer
205
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
2
answers
485
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
0
answers
204
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
0
answers
86
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
0
answers
746
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
1
answer
372
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
0
answers
158
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 ...