Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [python-2.7]

Version 2.7 of the Python programming language

3
votes
1answer
80 views

Why does osr.SpatialReference return different values in python2 and 3?

Can somebody explain why the result of osr.SpatialReference() differ between Python 2 and 3? sr = osr.SpatialReference() sr.SetFromUserInput('EPSG:28992') sr.ExportToProj4() In Python 2.7 this gives ...
-1
votes
0answers
8 views

Fully Constrained Least Squares (FCLS) Linear Spectral Mixture Analysis uisng python [on hold]

I have written code using Python for Fully Constrained Least Squares (FCLS) Linear Spectral Mixture Analysis, which could be applied for unmixing multispectral image successfully. However, the ...
0
votes
1answer
27 views

Choosing correct Projection name for ArcPy?

I am trying to plug in a projection name to my code, but I think the syntax/name is incorrect. arcpy.env.outputCoordinateSystem = arcpy.SpatialReference("US Albers Equal Area Conic") When I run the ...
1
vote
0answers
19 views

Using Null Values in Raster To NumPy?

I am trying a convert a raster dataset [a simple 4 x 4] into a numpy array using RasterToNumPyArray. Here is my sample raster dataset: RasterToNumPyArray however, returns zero for Null values: ...
1
vote
2answers
27 views

replaceDataSource() works in ArcMap but not as stand-alone script

I have one script (and one alternative) that I want to use to replace a broken data source. Neither is working outside of the ArcMap Python Window. Has it something to do with the MapDocument object? ...
2
votes
1answer
44 views

Installing Arcpy in an Anaconda enviroment.

I recently uninstalled Anaconda due to a conflict with my pandas packages. I use to have it configured with my ArcGIS Pro Python 3.65 environment. Now I want to reinstall it, but for my ArcGIS ...
0
votes
1answer
24 views

Using `arcpy.Exists()` and `arcpy.Delete_management` on a temporary layer

Suppose I make a temporary layer from a feature class in a gdb: select = arcpy.MakeFeatureLayer_management("roads", "select_lyr", "FIPS_CODE = '06023'") Later I want to see if that layer exists and ...
0
votes
0answers
21 views

python error in QGIS 2.6.1

I use QGis 2.6.1 and when I opened the file, I got this error (see below) and couldn't open the pie charts which I produced with QGis 3.2.2. Can you give me some information on this error and how I ...
0
votes
0answers
27 views

heatmap to polygon (only the hotspots)

I have a widgit that makes a heatmap from the proximity of points, I want to create a polygon layer just from the hottest spots(based on color maybe?), for example if the color range is blue to red i ...
2
votes
1answer
18 views

“AttributeError: Cannot parse SetParameterAsText” but my indexing is correct

I think I have all my indexing correct. I have 8 parameters in my script tool. 7 input and 1 derived output. Indexing for GetParameterAsText starts at 0, so logically my SetParameterAsText should ...
1
vote
1answer
18 views

Error when creating seach filter from geojson

I tried to read geojson object from .geojson and build search filter rather than set a static geojson_geometry variable. However, it did not work as it used to with the static variable. Win7 pro, Py 2....
0
votes
1answer
27 views

ExecuteError: Failed to execute. Parameters are not valid error when SelectLayerByAttribute run in Python 2.7

I am running a line of code in a Python 2.7 environment using arcpy.SelectLayerByAttribute_management: fl_haz_selects = arcpy.SelectLayerByAttribute_management(S_Fld_Haz_Ar, "NEW_SELECTION", "\"...
0
votes
1answer
28 views

comparing parcel ids from two tables with arcpy.da.SearchCursor

My goal is to compare parcel IDs from two tables, one is a standalone shapefile and the other is a feature class inside a geodatabase (SQL Server). Both tables field name is "PARID" and the values are ...
0
votes
1answer
40 views

Getting a token access to feature layer using Postman and Python

I am trying to query a feature server using postman as ESRI'S documentation: https://developers.arcgis.com/labs/rest/get-an-access-token/ I have succesfully added the Authorization to the body of the ...
2
votes
0answers
23 views

Clipping outside QGIS with PyQGIS?

This is my first script and I having a problem trying to clip a shp file. I'm running on a linux server and this is my code: #! python from datetime import date from qgis.core import * from PyQt4....
0
votes
1answer
19 views

gdal.Warp cutline creates empty file when run on the server, but works perfectly fine through Python command line

Trying to cut geotif with a shp file. When I open Python command line interpreter and run from osgeo import gdal gdal.Warp(outfile, infile,format='GTiff', cutlineDSName=shpfile, srcSRS='EPSG:4326',...
0
votes
0answers
7 views

How to change column's widget type on QGIS using Python [duplicate]

I need to automate customization of column's widget type in QGIS using Python, I know how to do it throw feature propreties>Fields, as shown in the picture below, but I can not find a python code that ...
0
votes
0answers
18 views

DLL error and 1073741511 error running GRASS from external Python script

I am struggling to run any GRASS 7.4.1 Session from outside using Python 2.7.15 with Spyder IDLE. While setting up the GRASS bin and GRASS environment are as follows are all good and showing no ...
0
votes
2answers
33 views

Iterate through tables in a map document and replace workspace paths using Python 2.7 and ArcGIS 10.4.1

I am creating a script that walks through folders and scans for mxds. I use a set to get unique data sources and copy the data to a new folder keeping the same data format. I would then like to access ...
1
vote
0answers
53 views

ArcPy not seeing ArcSDE datasets from IDLE or PyScripter? [duplicate]

I tested the code below from ArcCatalog 10.5's python console and IDLE+PyScripter. While in ArcCatalog everything works correctly(code is supposed to list available datasets and feature layers), in ...
4
votes
1answer
73 views

python GDAL 'GetDriverByName', argument 1 of type 'char const *'

i want to use python GDAL to convert some rasters files but i take error in the create new tiff image and specific in the line driver= gdal.GetDriverByName('GTiff') update : python version 2.7 64 ...
0
votes
1answer
64 views

Creating standalone python Script using PyQGIS?

I have written a code which solve my problem for Demand Allocation. I have Input (.csv)File and Output is also (.csv) File. However I have to integrate this script in Java Application.(https://...
0
votes
1answer
51 views

Integrate QGIS Plugin with Java Project [closed]

I have a Java Application. I am using QGIS to solve one such module of my Java Application. I have written code in python console within QGIS.Is there any way to integrate both of these? I am ...
0
votes
0answers
12 views

Qgis error: bin.exe stop after using my plugin the second time

I created a python QWizard plugin in Qgis. The code has roughly 1000 lines so I cannot show it here, but it has system calls (os.system), subprocess calls, layer creation, edition, processing.runalg, ...
3
votes
1answer
80 views

Select Layer By Location gives ERROR 000840 ({select_features} as arcpy.Polygon)

I tried to select SC27060054 point object using polygon. r"Project\project.DBO.Qo" is a point layer. import arcpy p1 = arcpy.Point(254426.380, 4664270.258) p2 = arcpy.Point(254432.730, 4664270.258)...
0
votes
0answers
29 views

Are there any of this concepts: 'last selected object', 'last query' or 'last cursor position' in ArcGIS Desktop?

Are there any of these concepts: 'last selected object', 'last query' or 'last cursor position' in ArcGIS? I want to use them in my python script. I think this will be an easy way to solve the task. ...
0
votes
0answers
69 views

Google Earth Engine Python API: indexing error with batch export to ImageCollection asset

Using the GEE Python API (Python 2.7) and geetools, I am trying to add images to an ImageCollection stored as an asset in GEE. I did not find any way to add directly a set of images stored as ...
1
vote
0answers
80 views

ValueError: array is too big

I'm trying to get the value of a pixel from a coordinate. The problem is when I use a large image, so this error appears Traceback (most recent call last): File "D:\algoritmo\teste_read_2.py",...
0
votes
1answer
46 views

Intersecting polygons from different layers based on common values using ArcPy? [closed]

I have two polygon shapefiles (ShapeA and ShapeB) that share some areas. The shapefiles have one attribute in common (CODE) and I would like to do a selection, where I select all the polygons in one ...
0
votes
1answer
27 views

List Esri GRID files from unique data sources in a CSV file using Python 2.7 and arcpy

I have a CSV file with a list of unique data sources extracted from an ArcGIS map document. I would like to list all ESRI GRID rasters that appear in the list. One example is: G:\GIS\Depts\Ex\PA\DB\...
0
votes
1answer
27 views

Python script parameters for Integer not working

I am using a Python library called arcpy_metadata that uses 2 datatype called max_scale and min_scale that take integers: My code for that is just: import arcpy, arcpy_metadata as md .... min_scale ...
0
votes
0answers
56 views

Clipping raster with different UTM zones using rasterio?

I have 2 Landsat images, with an overlapping area: The one on the left is in WGS84 / UTM32N (EPSG:32632), the one on the right is in WGS84 / UTM33N (EPSG: 32633). I have a polygon in WGS84 / UTM33N (...
1
vote
1answer
84 views

Export as DGN with QgsVectorFileWriter.writeAsVectorFormat

This code works in QGIS 2.14 but not in 2.18. What do I have to change to be able to export properly to DGN. From what I understand, now it tries to save in microstation V8 format instead of v7. I ...
0
votes
1answer
64 views

Loop every element in the same layer with a function using ArcPy?

I have the following code: import arcpy from arcpy.sa import * arcpy.env.workspace="D:/..." sp="StartPoint.shp" #Dataset that defines the zones zone_field="FID" #Field that ...
0
votes
3answers
68 views

Changing coordinate of point shapefile in ArcGIS using ArcPy? [closed]

I'm working on coding a function in ArcGIS trying to measure the number of pixels between a point (feature class) and its nearest building horizontally within a UDEM raster, then return the number. ...
2
votes
1answer
203 views

Downloading Sentinel-2 data from Google Cloud Storage with Python?

I'm trying to download Sentinel-2 data from the Google Cloud Storage and basically adapted the FeLS-module (great work, by the way!). As it is done in the module, I also download the index.csv first (...
0
votes
0answers
34 views

Get Path of my toolboxes ESRI addins Python 2.7

I need my toolboxes path. These are in the installation folder (toolboxes) but when using the function: dir_tools = os.path.join(os.path.dirname(__file__),r'toolboxs\parametros.tbx') result: C:\...
1
vote
1answer
204 views

Installing Anaconda for Python 3.6 without wrecking Python 2.7

I have both Python 2.7 with ArcGIS 10.5 Desktop and Python 3.6 with ArcGIS Pro. A few weeks back, I tried to install Anaconda (w/ Conda, Spyder, Jupyter, etc..) and it somehow overwrote my system ...
2
votes
1answer
191 views

Using Python to publish a JavaScript webpage

I am building a series of HTML web maps for a client (5000 location maps all HTML). I have a python script to execute a basic set of HTML tags to build a specific web page (Call this page 1). The ...
1
vote
0answers
30 views

Why does my Fiona output look different from my image

I'm trying to export my houghlines as a shapefile, which works. But the output the lines in my shapefile are very different then the generated hough lines that are shown on the image. Example: The ...
0
votes
0answers
10 views

How to export image with several transparency rules defined with another raster layer using python ?

I would like to export an image with several transparency levels defined in an other raster file but I have no idea on how to proceed using Python ? In other words, and with an example from qgis: on ...
1
vote
1answer
39 views

How to put value from different fields using Python?

Here I added a new field name "visArea" and want to put in the number from the "Count" column which "Value" equals one.That means the number of visible point(value=1)from selected observe spot.I used ...
0
votes
1answer
32 views

AttributeError: DescribeData: Method fieldInfo does not exist

I have a script that looks at feature class inside a .gdb and prints some simple information about the attributes field. Note- these is actually only one feature class in the .gdb. I want use the ...
0
votes
0answers
68 views

Python 2.7.13 cannot import ArcPy in ArcGIS Desktop 10.5.1?

I am using ArcGIS 10.5.1 and Python 2.7.13. I have also ArcGIS Pro on the same computer. Our license is in network server in our company. Import arcpy is currently not working. I had some tools to ...
3
votes
1answer
137 views

What is Esri's support plan for Python 2.7 beyond 2020 for ArcGIS Desktop? [closed]

According to PEP-373, Python 2.7 will retire on January 1, 2020 (Countdown Clock). That date was pushed back 5 years for those who couldn't migrate to Python 3. According to this product life cycle ...
0
votes
1answer
19 views

Entry point not found Error initiating GRASS GIS from Python

I cannot run any GRASS tools from within Python 2.7.15. While the GRASS environment, grass.script etc. are loading correctly and I can run basic checks like gscript.read_command('g.gisenv') gscript....
1
vote
0answers
68 views

Insert shp into existing Postgis table with python

I'm creating a Qgis python plugin that allows inserting shp into existing Postgis table, i've tried using ogr2ogr and it's workin when I run the command in FWTools Shell but when I try to run it in ...
0
votes
3answers
34 views

Trying to clip many layers using Python in ArcMap, getting error that an output already exists

I have a nationwide shapefile I want clipped into regions. There's not so many regions that I need to script iterating through each region, but there are enough where I want to batch process this. I ...
0
votes
1answer
53 views

Removing layer from TOC when it has space in name using ArcPy?

I am trying to remove layers from the TOC using Python Toolbox. It works provided that the layer names have no spaces in their names. Tho whole script looks like: class ...
0
votes
1answer
25 views

Python crashes while using CopyFeatures in ArcPy?

I'm using Python 2.7.8 and ArcGIS Desktop 10.3.1 to automate some of the ArcGIS workflows with Python scripts. My code started crushing with no error message as follows: The main issue was that there ...