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

1
vote
0answers
22 views

How to find how grass's r.viewshed works programmatically?

I want the Python source code of Grass's Viewshed analysis. In QGIS software there is only an .exe file of that algorithm. Although I'm not sure whether it's written also in python or not. Where can ...
0
votes
1answer
22 views

PyQGIS import from UI class problem

I've tried to build a plugin from scratch to better understand the plugin structure and so on without the help of PluginBuilder or similar tools so my code could contain flaws. I went through every ...
1
vote
1answer
33 views

NumPy array to Raster file (GeoTIFF)

I converted a raster file (one band grey scale) to an numpy array and set a range to it. I Did like that: import gdal import numpy ds = gdal.Open('H:/GDAL_docs/a.tif') myarray = numpy.array(ds....
1
vote
1answer
43 views

Joining single column in ArcGIS Desktop with Spatial Join

I'm trying to automate a rather annoying workflow in ArcGIS 10.4 with a Python script. My goal is to extract data from a polygon shapefile into another polygon shapefile which is arranged as a raster (...
0
votes
1answer
35 views

Configuring ArcGIS Desktop to use already installed Python instead of own installation? [duplicate]

Whenever ArcGIS Desktop is installed, it installs its own installation of Python 2.7 plus Numpy. Yet, I already have many different versions of Python installed in my machine and do not want to have ...
1
vote
0answers
19 views

gdalcalc.py in Python 2.7 subprocess Popen - not spawning, nor any Exceptions

from subprocess import PIPE, CalledProcessError, Popen import subprocess import osgeo raster = '/home/rphillips/Desktop/tif_dir/merged.tif' raster_dir = os.path.dirname(raster) binary = raster_dir +...
1
vote
1answer
38 views

Comparing pixel values at a given point in two rasters

I have two raster images, one for land use and one for NDVI, i would like to calculate LAI based on land use. So i need to compare the pixel value in the NDVI raster and Land use raster then select ...
1
vote
1answer
37 views

Merging on specific fields

Lets say I have three shapefiles/features I want to merge: 'florida.shp', 'mississipi.shp' and 'louisiana.shp'. They all have 3 standard fields common to all: 'DFIRMID', 'SFX', and 'FIRMPAN'. I want ...
-1
votes
0answers
29 views

Listing Services in ArcGIS Server

I'm tying to get the list of services and data source of the services in ArcGIS Server. I'm working on a client machine that does not have ArcGIS Server installed. Is there any Python script to fetch ...
2
votes
1answer
36 views

Copying feature classes from gdb to different folder locations in Python?

I am very new to Python, and I'm trying to create a function where I'm copying over feature classes from a gdb to different folder locations as shapefiles. The script needs to be reading from a ...
1
vote
0answers
28 views

Numpy import error in OSGeo4W Shell

I and my colleagues are running into a very frustrating Python import error while using the OSGeo4W Shell. Any time we attempt to use gdal_calc in a Python script, we get the following error message: ...
-1
votes
0answers
20 views

Python script for BandMaths

I am writing a python script for band maths: import os import sys import glob import gc import snappy from snappy import jpy from snappy import GPF from snappy import ProductIO from snappy import ...
1
vote
0answers
31 views

Loading shapefiles in standalone PyQGIS application without GUI

One of the related questions mentions an issue with import order, but I don't think that applies here because this is a command-line script: I'm not using Qt, only QGIS libraries. I'm trying to run ...
0
votes
0answers
32 views

QGIS plugin/Python Script

I am looking for a plugin / Python script for network analysis. Road Graph plugin does give shortest path in distance or time but I need the second and third best option as well.
0
votes
0answers
47 views

SNAP operations over Sentinel-1A images using Python

While writing code for operations of SNAP using python: filterSizeX = '5' filterSizeY = '5' polarisation = 'VV' wkt = 'POLYGON((17.06138 98.4766, 17.07500 98.55027, 17.11833 98.54166, 17.10500 98....
0
votes
0answers
27 views

Subset of Sentinel-1A image using python

I am using python for making a subset of Sentinel-1A image. While writing the code: import snappy from snappy import ProductIO from snappy import HashMap import os,gc from snappy import GPF GPF....
4
votes
1answer
104 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 ...
0
votes
1answer
32 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
25 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
34 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
135 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
25 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 ...
-1
votes
0answers
34 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 ...
2
votes
1answer
24 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
19 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
39 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
32 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
63 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
25 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
23 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
8 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
26 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
40 views

Iterating through tables in map document and replacing workspace paths using ArcPy?

I am using Python 2.7 and ArcGIS 10.4.1 to create 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 ...
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
105 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
71 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
77 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 ...
3
votes
1answer
87 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
30 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
114 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
158 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
59 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
70 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
120 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
65 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
71 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
284 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
36 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:\...