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

learn more… | top users | synonyms

6
votes
1answer
316 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 ...
4
votes
1answer
936 views

Setting the extent for a QGIS map using python

I am writing a stand-alone application in Python/QGIS that simply creates maps. I want to load vector/raster layers, set symbology, set extent At the moment, that is all! Currently I am just using ...
4
votes
1answer
328 views

QGis Zonal Statistics Plugin NoData included in Calculations

I have been trying to use the QGIS zonal statistics plugin. My raster has a nodata value of -99999 and all other values are positive. After computing the mean zonal statistics there are a number of ...
3
votes
1answer
60 views

No get more option in QGIS

I have recently installed QGIS and trying to work with it but I don't see this option "Get More" at all. As suggested by some previous source, I also checked whether I am behind a proxy but that isn't ...
3
votes
1answer
65 views

Is there a tool to track edits that were made?

Is there a tool/report that keeps track of what edits were made that I could run prior to or after reconciling my versions? This would help me to know if there are any changes I need to make to any ...
3
votes
1answer
242 views

How come “Zoom to Polygon” always puts me in the middle of Nebraska?

This is an issue related to this question I'd asked a few days ago. I've got that code working, to an extent. Every time, though, that I double click on one of the Polygons in the attribute table that ...
3
votes
1answer
163 views

draw lines with an angle inside a rectangle in python

I am trying to make a plugin for Qgis with python. I have the four corner coordinates for a rectangle. I want to give the user the inputs, line space and angle (0 -180 degrees). With these inputs, I ...
3
votes
1answer
559 views

Reset python add-in

I have a toolbar which enables a second and third combobox when a selection is made on the previous. I would like to add a button to 'reset' the toolbar. Basically reload the toolbar to it's original ...
3
votes
1answer
226 views

How to clip a Oracle query layer directly in a Python script?

I have a query layer directly running from ORACLE database in a MXD. I want to clip this layer with a layer being created in another MXD in a Python based tool. My question is to do this clip ...
3
votes
1answer
252 views

Python SQL connection causes crash in ArcMap

I have the following code which I have striped down to just included the part that is causing a crash in ArcMap. import pymssql # Connect to the Research db using Windows Integrated Authentication. ...
3
votes
1answer
864 views

Multiline VBScript Label Expressions in Arcpy

I am able to set simple label expressions, but when I try to set multiline expressions (which all VBScript expressions are) it does not get copied into the expression box properly. I have tried using ...
2
votes
1answer
44 views

calling gdal_merge.py into another python script running GDAL processes

Good Afternoon All, I am wanting to use gdal_merge.py to merge a series of .tif files prior to clipping the merged file to a shapefile boundary, but want to do so as part of another larger script ...
2
votes
1answer
75 views

PostgreSQL PL/Python Function for “IF” condition

I am using OSM data to run pgr_dijkstra() for weighted-path calculation. But after importing OSM data using osm2pgsql I populated some additional columns into my ways table. So now it has gid serial, ...
2
votes
1answer
29 views

Cut polygon shapefile with 2 parallel lines to derive new inside polygon?

Using Python scripting: How can I clip a polygon shapefile with parallel lines (polyline shapefile) to derive new inside polygon?
2
votes
1answer
49 views

Loading features attributes into numpy array

I am currently working on an add-on that relies on the user choosing fields of tables (that can be from shapefiles, csv or dbf) that are open in QGIS and then making computations with such data. ...
2
votes
1answer
72 views

ringer: help convert simple plugin to new QGIS 2.x

I have been trying to get this simple plug-in to work on QGIS 2.x. So far i got it to load, but it does nothing! all that it is supposed to do is place a polygon where a hole (ring) is. The code is ...
2
votes
1answer
51 views

How do I link OGR with spatialite?

Problem & Evidence: I'm trying to create a spatialite file with the code snippet below. However the outDataSource object gets assigned NoneType and all subsequent (unshown) code fails. I'm ...
2
votes
1answer
60 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 ...
2
votes
1answer
53 views

How do you duplicate a point within a shapefile using Python?

How do you duplicate a point within a single feature class using Python? I have a partial sample script below, but in a nutshell, I want to duplicate a point, copy it into the same shapefile, and ...
2
votes
1answer
61 views

Randomly choosing one from multiple fields in Field Calculator of ArcGIS for Desktop?

Using the Field Calculator in ArcGIS for Desktop, I want to randomly choose one field from a list of 10 fields (strings). The Excel equivalent, which is working, is: =INDEX(A2:J2;rnd()*10+1). How ...
2
votes
1answer
50 views

Python Error while installing Cartogram

I am quite new to GIS and qGIS especially. I would like to install cfarmers cartogram plugin. From what I understand, this has to be done manually - so I 've followed the instructions from ...
2
votes
1answer
42 views

Automating polygon mergers with python

This is the first real world python program am trying to write. I am trying to create a scrip that takes a shapefile that has n polygons with an integer formatted date (e.g. yyyymmdd or 6/24/2014 is ...
2
votes
1answer
234 views

Configuring spatialite database access for Python 2.6.6

I'm working on a GIS project, and I would like to implement and test some geo-spatial algorithms in Python. For this purpose, I will not only need sqlite, but also spatialite, in order to store and ...
2
votes
1answer
180 views

Python problem visualization .tif image

I am trying to read a hyperspectral image in Uint16 .tif format and visualize it. I use GDAL in Python to read the data and everything works perfectly when I use matplotlib to show one band of the ...
2
votes
1answer
74 views

Conditional SQL Query

I've been running a code that searches a desired field in a feature class and performs an specified SQL query based on whether the field is string or double. The variables are just temporary fillers ...
2
votes
1answer
93 views

update cursor to calculate field

This is my first post, so any help is greatly appreciated. I'm trying to use an update cursor to calculate a field. Basically, I'm trying to avoid division by 0 by looking in row[0] and see if it's 0. ...
2
votes
1answer
171 views

How to use SAGA ShapesToGrid via Processing in a Python plugin?

I run these lines in my code: vectorlayer_vector = ftools_utils.getVectorLayerByName(inputLayer) Elevation = self.lineAttrib.currentText() cellSize = int(self.linePix.value()) outPath = ...
2
votes
1answer
96 views

Is it possible to destroy a spatial index?

QGIS 1.9 Is it possible to destroy a spatial index? I am noticing that if I generate a spatial index on a set of polylines (within a plugin), split one of the lines, and then recreate the spatial ...
2
votes
1answer
233 views

Arcpy Network Analyst solver error

Hello GIS Stack Exchange, I am finding it difficult to load locations to sublayers using python in ArcGIS 10.0 network analyst Vehicle routing problem. I'm also having some trouble debugging my ...
2
votes
1answer
298 views

View HTML field data with QT4 browers as a QGIS Run Feature Action Tool

I've successfully populated a sqlite table with an HTML-encoded-table as a field attribute, and so there is literally a Table within a single field value in sqlite, for each record. This is going to ...
2
votes
1answer
563 views

How to debug 'Layer is not valid error' from Python plugin?

I'm trying to understand what goes wrong with a QGIS python plugin. Basically I'm trying to render a series of POINT. The query works fine, at least giving it by hand from inside PostGIS DB: "SELECT ...
1
vote
1answer
29 views

How to add IDs of the links composing a polygon?

I build up a polygon layer from a road network for finding roundabouts using the compactness factor of a polygon. Then I have to intersect the extracted roundabout polygons with the road network so ...
1
vote
1answer
9 views

Converting a large set of GRIB2 files to a spreadsheet format

I have a large set of .pgrbf.grb2 files downloaded from the Climate Prediction Center, and I need to run statistical analyses comparing them to data that was produced locally in .csv format. I'm not ...
1
vote
1answer
41 views

how to open shp file which created by using python-ogr in qgis?

I have done following steps, so how I open that created shp file in Qgis driver=ogr.GetDriverByName('ESRI Shapefile') out=driver.CreateDataSource('pts.shp') ...
1
vote
1answer
29 views

Raster created by python GDAL interpreted upside down

I am using CRS which has axis in left bottom corner. Code below produce Geotiff which is shown allright in QGIS but when I open it in other software it is upside down. Also gdal_calc takes it as ...
1
vote
1answer
35 views

Programmatically access HTML Popup in Layer Properties ArcGIS 10.2

Is it possible to access HTML Popups (found in layer properties) programmatically in ArcGIS 10.2? I can't find any reference but thought I'd ask to double check.
1
vote
1answer
43 views

Load feature class with tab delimited file that is missing Lat/Long

I am working on a Python script that receives a nightly tab delimited flat file. This flat file has Latitude and Longitude fields and the script loads the data using the gp tools Make XY Event Layer ...
1
vote
1answer
73 views

Using GDAL to read dted files

How do I get the elevation at a certain point using gdal to read in a dted file? I don't see much useful information out on the web. I'm sorry I should have been more specific. How would I ...
1
vote
1answer
114 views

Installing Pandas in ArcGIS 10.2 for Desktop?

I followed the very clear directions in the answer to Installing pandas with Esri's python? and created the Esri101 build and added a "conda.pth" file to my ...
1
vote
1answer
29 views

pyQGIS - Data Source is Invalid

Why I am getting Data Source is Invalid in python console of QGIS when running: vlayer = QgsVectorLayer("home/sanjayr/Desktop/india-latest.shp/buildings.shp","sanjay","ogr") I am using QGIS 2.4 on ...
1
vote
1answer
107 views

UnicodeDecodeError: While installing gdal in a new Python Virtual Environment

I was trying to create a Python Virtual Environment for some initial GIS development. I installed pip and virtualenv and then tried the following commands from the Linux-Terminal to accomplish the ...
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 ...
1
vote
1answer
59 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 ?
0
votes
0answers
100 views

How to create a pop up attribute table for each crash located on a roadway segment in arcmap

I am trying to create a simple user interface that displays information for each crash located on the routes. I also need to display a graph along with that. I am a beginner in Python with no prior ...
0
votes
0answers
150 views

How to build QGIS with Python on Redhat?

I'm attempting to run QGIS on Redhat 5 64 bit architecture. Version of Python is 2.4.3. Version of QGIS is 1.7.4 (wroclaw). When I run qgis, the splash screen appears, followed by a QMessageBox that ...
0
votes
0answers
159 views

Export Data Driven Pages extents to Kmz

Is it possible to export the extents of DDP to KMZ using arcpy - Map to KML (Conversion)? Alternatively can we export each extent of a single DDP extent to a new mxd and then run arcpy.MapToKML_3d on ...
0
votes
0answers
149 views

How to enable user to specify field mappings from a table joined to a feature class?

I have a feature class and a new table every few days. I need to have the table's attributes added to the feature class based on a join. What would be a good interface in ArcMap to let the user map ...
0
votes
0answers
254 views

Missing QGIS python plugin database connectors

I am working with python plugins for QGIS.I developed my plugin and inorder to incooperate the same into QGIS i copied the folder in C:\Documents and Settings\comp90\.qgis\python\plugins I opened ...
0
votes
0answers
98 views

Is there a better method to fix empty pixels after classification?

empty pixels occurs after classification - in arcmap you can use Generalization tools such as majority filter. However is there a script you could write to better fix it? for example - some of the ...
-3
votes
0answers
36 views

Exporting group layers from Table of Contents (TOC) to Folders of shapefiles?

I have some group layers in the Table of Contents (TOC). Each group of layers references a few shapefiles from different source folders. I would like to export each group layer name as a folder and ...