Python is an open source interpreted programming language used in many GIS programs.

learn more… | top users | synonyms

10
votes
2answers
4k views

How to export only certain columns to a CSV file in ArcGIS?

I've written a python script using arcpy which outputs a polygon feature class into a File Geodatabase. I have added a function to export the attributes to a separate CSV file. I am using the code ...
1
vote
1answer
20 views

Python version of MAP_2POINTS

I think I may have stumbled onto an IDL function which does not have a python equivalent... :'( I am working with a Whiskbroom imaging radiometer (Terra/Aqua MODIS), with a corresponding bounding box ...
4
votes
2answers
66 views

How to access raster NoData value?

I am trying to programmatically access the NoData value in a raster dataset as shown in the screenshot. Two tools that come to mind to describe raster properties do not seem to be able to describe ...
0
votes
1answer
430 views

ArcPy SelectLayerByAttribute Error and how to control GP output layer name

I have a rather long script that first references an SDE feature class (non-versioned) to perform an attribute selection based on a SQL selection. I've been unable to figure out why the script will ...
0
votes
1answer
41 views

Field Calculator If/Then in ArcGis 10.1

I've been looking through these threads, i found something similar and thought it could be the answer, but it doen't seem to work for me... I could do this the slow way with Select By Attributes, but ...
6
votes
1answer
85 views

How to get layer list of layers that are published?

I'm stuck. I've been using geoserver with python extension gsconfig library for a while now. Almost everything works as it should be. While there are little things like publish raster images are ...
1
vote
1answer
40 views

geotiff conversion to coordinate system with gdal

I would like to get the coordinates X Y Z from a geotiff file. I am using the gdal translate for the conversion. Which output format is the more adequate for containing a 3 numpay array X Y Z ?
2
votes
0answers
40 views

Filtering MSSQL layers in QGIS doesnt work

In my QGIS Plugin I am filtering layers with this Python code: FeatureIterator = layer.getFeatures( QgsFeatureRequest().setFilterExpression ("Fieldname='SomeValue'") ) for feature in FeatureIterator ...
1
vote
0answers
20 views

lat/lon of intersection between line of sight from a given lat/lon and altitude above ground

Given a starting latitude, longitude and altitude, and a line of sight defined by azimuth and elevation, I want to find the latitude and longitude (assuming spherical Earth, WGS84 or other) where the ...
0
votes
0answers
23 views

gdal_grid performance issue — alternatives?

I use gdal_grid within a Python script, but for my large files the calculation time is enormous. Apparently this is a gdal_grid issue http://trac.osgeo.org/gdal/ticket/2411 Does anyone have an advice ...
2
votes
2answers
39 views

Performing a Python scripted tool based on whether a field is populated or not

My question is if I'm running the ArcMap Dissolve tool through a Python script, how can I tell it to check for attributes in one field, and if that field is empty, to perform the tool on another ...
2
votes
1answer
35 views

Map algebra from files in multiple directories

I'm a rookie in python programming. I want to do map algebra for multiple rasters but these rasters are in different folders. Here's the code ive created so far: #Importing modules import arcpy from ...
1
vote
0answers
39 views

Scaling features based on an attribute

I would like to scale polygon features by a specific factor I have calculated for each feature in a feature class. I know of the Scale tool, however it only allows for manual entry of a scale factor ...
6
votes
1answer
127 views

How to get status of a layer in geoserver using gsconfig?

I am getting all published layers from geoserver using gsconfig using following code: from geoserver.catalog import Catalog cat=Catalog("http:// localhost:8080/geoserver/rest") myResource = ...
0
votes
1answer
64 views

Get Index for a group QGIS Python

I am trying to add new layers into a specific group which I can get to work if I know the index but how can I get python to fid the index of a group so it can load the new layer into the group ...
2
votes
1answer
60 views

Python console not working at all

My python console won't work at all. I can't open it. My QGIS version is 2.4. OS is win7 64. I've reinstalled QGIS a few times but I always get the same result. Strange. Something went wrong with the ...
7
votes
2answers
175 views

How to access current job id from geoprocessing script running on esri server?

I want to programmatically access the current job id of a geoprocessing script running on ESRI 10.2. The script is what needs to know the job id, not the caller of the script. While searching, I ...
1
vote
1answer
461 views

Linux Client for OpenGTS server

I've installed an OpenGTS server and successfully linked it with the GPS2OpenGTS_Pro application for android. The buses I'm tracking offer 3G with a wireless AP, however whenever the bus stops, the ...
1
vote
1answer
58 views

How to merge Shapefiles from multiple folders into Geodatabase Featureclass?

I have a question regarding the merge of a lot of folders, which has a lot subfolders, which has the shapefiles stored. I would like to merge all those in one geodatabase. So I thought to use a ...
0
votes
0answers
21 views

QGIS plugins - how to use a custom behaviour on right click and actionPan on left click?

I have been struggling with this problem for quite a long time. Here we go : I implemented a maptool that draws a red cross on the point that is being right-clicked on. There are good how-tos, such ...
1
vote
0answers
32 views

How to batch process near feature distance in ArcGIS

I have 2000+ point shape files. These are all GPS tracks. I want to calculate the distance from each point to the nearest feature (road, train line, restaurant etc) within a 30 meter radius. I am ...
1
vote
1answer
120 views

QGIS Python Labelling

i want to label a point layer with those values exceeding a set of variables attribute table as follows 'loc field'(text),'a'(float),'b'(float),'c'(float) variables as follows vara = 5, varb = 3, ...
2
votes
2answers
72 views

Automated search of misplaced points with Python or Model Builder [closed]

I am using ArcGIS 10.2.2. My work is to find points which are misplaced. I want to know if there's a way to automate this using Python or Model Builder? I wish to place this in the attribute table ...
1
vote
1answer
134 views

How to get a the minimum value of a raster layer in qgis with python? [closed]

I'm very new user of QGis and I work with landsat 5 images. In this framework, I would like to make an atmospheric correction subtracting the minimum value present in each band (1 to 4). My ...
4
votes
1answer
69 views

How do you set the position of a plugin window when you start the plugin?

I'd like to set the position of a plugin's window or dialog relative to the map canvas frame. For example, if I start a plugin, I want it to appear somewhere in the left upper corner of the map ...
4
votes
1answer
38 views

Can QGIS map canvas update while python script is running?

I want to automate a periodic refresh of the QGIS map canvas with updated shapefiles. A Python plugin or console script does not allow the map to update until the script terminates. Is there a way to ...
2
votes
2answers
138 views

Is there a function to select a region of a map for further processing with Python?

I would like to select a map's region in QGIS for further processing with python console. Ideally I would like to select the region with a mouse drag (like Gimp crop function) and then e.g. analyze ...
1
vote
1answer
135 views

Raster extent, just clipped by geomtery, slightly differs from a given geometry

The raster using arcgis geoprocessing is cliped with a feature, reading it's geometry and as a result, rasters extent slightly differs. Extent of geom: str(row.shape.extent) '570600,537958652 ...
1
vote
2answers
77 views

Concatenating fields with label expressions using Python

I am trying to combine three numeric fields together for a feature's label. I only want to label the feature if it is over 0. The labeled numbers need to be separated a dash ("-"). This is what I ...
1
vote
1answer
631 views

GDAL loads in Python, but not IPython (Linux)

I am trying my hardest to utilize the work of the good folks at the GeoDa center, but I cannot seem to get all of the components to load. GDAL, in particular, has been giving me some difficulty. The ...
0
votes
1answer
39 views

What is a simple python code to practice with in arcgis? [closed]

I am trying to familiarize myself with python code. Could someone give me a simple code with an explanation of what it does so I can practice? Or a few codes with explanations if you have the time
1
vote
1answer
448 views

Scipy: Convert RGB TIFF to grayscale TIFF and output it on Matplotlib

I want to manipulate RGB bands in a TIFF file and output the grayscale map on matplotlib. So far I have this code, but I couldn't get it on grayscale: import scipy as N import gdal import sys import ...
1
vote
2answers
47 views

Creating shapefile from selection - remove from map

I am iterating over a shapefile and creating a new shape from each row. I will be creating several thousand individual shapes and do not want to inundate my TOC with that many layers (I bet ArcMap ...
1
vote
1answer
49 views

QgsMapRenderer to export current extent using PyQGIS

I am trying to accomplish PyQGIS simple map rendering via the QGIS 2.0 Python console, but end up with only a blank image. I've followed instructions of this link. My objective is to export a simple ...
5
votes
2answers
225 views

Is there a way to calculate closest distances to a point without using Near Analysis?

I frequently get asked to calculate distances from a specific point (A drilling well in the middle of the sea for example) to a number of Environmental layers (Protected Areas, Pipelines, Other wells ...
4
votes
1answer
48 views

How to extract certain values from a table using the SearchCursor Tool

I am trying to write a python script to extract certain values from a table: the table I am referring to is a big collection of nitrate values for different water depths, which are deposited in the ...
2
votes
1answer
26 views

Open a .osm.pbf file with fiona in python

I would like to open a .osm.pbf using fiona in Python. I can't find much documentation on this. How can I does one do this? I have done it using ogr2ogr.
3
votes
0answers
35 views

ArcPy: Initialize zero valued grid Raster and iteratively increment

I'm jumping right into ArcPy to help out a friend who needs to automate some ArcGIS work. The problem at hand can be reduced to the following pseudocode: accumulationRaster = SomeZeroedRaster for ...
4
votes
3answers
62 views

Install gdal in CentOS without Root

I have been struggling to get python setup to do some image processing, so I really need the http://www.gdal.org/ GDAL libraries installed on CentOS 6.5. I want to install the package in a local ...
0
votes
2answers
162 views

QGIS 2.4: plugin changes map tool canvas click behavior from 2.0

I had created a plugin for QGIS 2.0 to add new features more easily. It involves changing extents and updating snapping options along with triggering the default actionAddFeature(). However, I've ...
4
votes
0answers
52 views

Preparing Huff model with data to use in QGIS? [closed]

I'm trying to find out about the notion of potential of acessibility using the methods of Huff. I´m using QGIS, with point data (with the variables that I would like to use) and polygons for Europe ...
0
votes
1answer
133 views

Using Union on multiple shapefiles to output single result

Using QGIS 2.2 and Python, I would like to use the Union algorithm on multiple shapefiles (contained in a folder TEST) which would then produce single shapefile containing all the data. Currently ...
3
votes
2answers
54 views

GDAL (Python) Aggregate Raster Into Lower Resolution

I have a (continent-scale) raster with 30m resolution in an Albers equal area projection. Each 30m cell has a value 1-34. I would like to aggregate information from this raster into a 1km grid such ...
6
votes
1answer
220 views

Calling external files in Python Geoprocessing Service

I have created a Python script which calls an R script and then reads the output back into Python. I can run this tool in ArcGIS Desktop (10.2.1) and it works fine. When I publish as a geoprocessing ...
2
votes
1answer
32 views

Is it possible to remove parameter values from the Python Window when running a script in ArcGIS?

When I run a python script in ArcGIS Desktop 10.1 the values from the parameters will be written to the Python Window (marked with red in the picture below). Does anybody know if it is possible to ...
4
votes
1answer
147 views

How can I modify layer order with the QGIS python API

Typically, after a new_layer = addRasterLayer(...) that inserts new_layer before the active layer, I'd like to move it to the top of the table of contents. How to do it? I use an existing QGIS ...
1
vote
2answers
52 views

Arithmetic on rasters with variable names in Map Algebra/Spatial Analyst?

I'm a Python (and StackExchange) novice trying to figure out how to perform calculations on temporary rasters with variable names. My attempt at a minimum working example is below, but I would ...
-1
votes
1answer
37 views

Displaying Shapefiles using Python? [closed]

I have some shapefiles, which I want to display in Python. Is there any code for that?
2
votes
1answer
153 views

Does ArcMap/ArcPy support creation of textElements using Python?

From what I can tell python at ArcGIS Desktop 10.0 cannot create new textElements nor GraphicElements. Yet, 10.1 seems to support the ability to at least create a clone, of a existing GraphicElements, ...
4
votes
2answers
315 views

How to write scripts that can call on both Arcpy and PyQGIS?

I have spent quite a bit of time looking for a clear answer this topic and have still been unable to really accomplish my goal of accessing PyQGIS in a stand alone script. Parts of answers have been ...