Tagged Questions

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

learn more… | top users | synonyms

1
vote
1answer
401 views

Convert polygons in shape file to a numpy array?

I have a shape file containing a number of polygons and all attributes being text. I'm trying to import the polygons into numpy as an array where each polygon is represented as unique values. I ...
0
votes
0answers
58 views

How to showing a Matplotlib figure in a QGIS plugin

I created a plugin for QGIS, But I want it to show a pi chart when you press on a button. But When I do this nothing happens, also when I try to show the chart by typing the code into the QGIS python ...
2
votes
2answers
143 views

Can I use the LEFT (string) operator in ExecuteSQL()?

In QGIS I can use the LEFT operator on a dataset like this: LEFT( "Name2",3) ='031' What is the syntax for using this expression with ogr in python? Isn't this the right syntax? ...
2
votes
1answer
597 views

How to use PyQGIS ( Python QGIS API ) to open/close Update Drawing Order checkbox in QGIS2's Layers (Legend Interface)

Thanks qgis 2, the Legend Interface (layers dockwidget) now has Update Drawing Order check box on right-click mouse context menu. I think this feature can let user temporally closes rendering, then ...
0
votes
1answer
225 views

Cannot import gdal_array

I attempted to use GDAL without installing due to not having rights to install on this computer. I managed to get several gdal modules working, but when I attempted to use ReadAsArray() I received the ...
0
votes
0answers
108 views

Missing pyexpat on QGIS 2.0.1: pyuic4 fails

I have encountered a problem when trying to develop a custom plugin for QGIS 2.0.1 (Python 2.7.5 with two additional Python installations on the same machine). When I try to compile the UI file ...
0
votes
0answers
59 views

QGIS 2.0.1: Changing layer properties with python console

I'm working on a plugin that will aim to ensure that the following steps either "transparent" to the user with one click :   Creating a table with predefined fields Record in this table in postgis, ...
1
vote
1answer
85 views

turn a Result object into a number

**import arcpy from arcpy import env from arcpy.sa import * import math # Check out any necessary licenses arcpy.CheckOutExtension("spatial") # OverwriteOutput arcpy.env.overwriteOutput = True ...
3
votes
3answers
176 views

pyscripter out of memory

I'm running a loop that create feature classes at a geodatabase. After creating 221 datasets I get the error message "pyscripter out of memory". Is there a way to clear the physical memory of computer ...
4
votes
1answer
245 views

Python libraries for correlating Photo to GPX file?

Can anyone recommend a Python library(s) that can geotag a photograph with the lat/long coordinates by correlating the timestamp of the photograph to the timestamp of a waypoint within a GPX file? I ...
0
votes
0answers
35 views

How to update ValueTable in ModelBuilder?

I have created a python toolbox script that will the update of the values in a ValueTable based on selections from other parameters. In the updateParameters when a parameter is changed I am updating ...
3
votes
2answers
255 views

Using python to Raster clip the extent to be the same as the display?

I've been trying to figure this out for almost a week now. I am creating a tool which first needs the raster to be clipped out to the current display. I have tried all sorts of things. Below is the ...
0
votes
3answers
217 views

Is it possible to use GDAL without admin rights?

I am trying to do some image analysis in Python but am unable to install GDAL due to limited rights. I have attempted copying some of the files and folders into my python folder but am constantly ...
5
votes
2answers
356 views

Download data via a ftp server using polygon features

The attached script loops through the features of a polygon featureclass and uses that attribute information to download particular files via a ftp server. The script works great for downloading ...
1
vote
2answers
262 views

Efficient way to store multiple values of an x,y location in Python?

I am trying to read values from a stack of images and store them in a structure that will allow for easy readability. My current idea is to create a loop for x in width: for y in length: ...
1
vote
1answer
791 views

OGR Layer Intersection

I am using what I would describe as the most primitive method of doing intersection with OGR. The short script below describes how I do it. Is there a best way of doing this? from osgeo import ...
4
votes
1answer
1k views

Finding duplicate records in a field via Python in field calculator

im looking for duplicate records in dbf files based upon the attribute called 'ID'. I have various dbf files from 500,000 records to 1.5 million and I know there are a host of duplicates. I would ...
0
votes
0answers
59 views

Best way to group datasets by country/region

I 'm using ArcGIS 10.0 and have a folder with misc GIS datasets from all over the world. I wrote a script that finds all of these datasets and writes them to a .csv file, but I also want to identify ...
2
votes
2answers
554 views

Automatically download Modis image using python script

I need download Modis imagery automatically from the website: https://earthdata.nasa.gov/. I found this link: http://gis-techniques.blogspot.com/2010/06/getting-modis-image-automatically-from.html ...
2
votes
1answer
173 views

How to use Python console under QGIS 2 with gdal module?

I am trying to move my plugin from QGIS 1.8 to QGIS2.0. However, the gdal module cannot use under QGIS2.0. I try to use Python console, typing: import gdal #it's OK gdal.GetDriverByName( ...
1
vote
1answer
404 views

Why does copying ArcSDE datasets and features in Python give ERROR 000732 & 000735?

Go easy, I'm new to python I keep getting a kick back that says this: ERROR 000732: Input Features: Dataset 'Database Connections\Wyoming.sde\Supporting_MT_DBO_Geology' does not exist or is not ...
3
votes
1answer
222 views

Serialize python list containing geometry

In simple case if list doesn't contains geometry all works fine: result = [dict(f.fields, id=f.id, label=f.label) for f in features] json.dumps(result) But if result list contains geometry ...
3
votes
2answers
92 views

How To Determine Percent of Matched Data?

In my attribute table, I have 2 columns with qualitative (categorical) data. Both of them are from different sources so I am trying to find the percent of matched data from these 2 columns. I created ...
3
votes
1answer
98 views

How to find lowest value that is not null using Python in ArcGIS for Desktop?

I have four fields in my table, (A,B,C,D). The field type is double with some fields being NULL. I used min(A,B,C,D) to return the smallest value and it works well if there are no NULL value in any of ...
0
votes
1answer
108 views

OS X Python vs QGIS Python

I'm wondering why after I updated to Python 2.7.6 on my OS X 10.9 Mac, QGIS Python console says that it is still running the old 2.7.5 version. This is not affecting my work but I'm curious about why ...
4
votes
3answers
376 views

How to find/replace element in field with Field Calculator

I just want to perform the following operation done in Matlab into the Field Calculator using Python: p(p==0) = 0.001 ; p(p == 1) = 0.999; tVar = .5*log(p ./ (1 - p)) the operation consists of a ...
0
votes
1answer
436 views

Shapely LineString and Polygon intersect?

here is my python code, it does not intersect and when I plot this in google map , I see the intersection. shapely.geometry is in Cartesian plane, how you are solving this? l = "40.65:-114.07 ...
0
votes
0answers
210 views

How to use dbscan in python for gis coordinates?

I am curious how to input gis coordinates (lat long) in the http://scikit-learn.org version of dbscan for python. Thanks
0
votes
0answers
105 views

recording pixel value with Python script in ArcGIS 10.x

A scripting newbie question... I'd like to write a Python script for ArcGIS 10.x that would record the pixel value for all pixels in a raster. Furthermore, I'd like to only record a given value once ...
3
votes
1answer
81 views

What is QGIS equivalent of ArcGIS GetCount for use in Python script?

I have a number of layers in QGIS that I would like to select attributes on, and get the feature count for, within a Python script. In ArcGIS for Desktop I have been using SelectLayerByAttribute ...
0
votes
0answers
43 views

recording pixel value with Python script in ArcGIS 10.x

A scripting newbie question... I'd like to write a Python script for ArcGIS 10.x that would record the pixel value for all pixels in a raster. Furthermore, I'd like to only record a given value once ...
1
vote
3answers
196 views

How to prevent ArcGIS SOC from locking Oracle tables?

I have a python geoprocessing that performs CRUD operations on feature classes and oracle tables. Sometimes, when handling Oracle tables, ArcGIS SOC gets hung and locks the Oracle table. I need then ...
0
votes
1answer
108 views

Shapely Python NameError when using cascaded_union

I am fairly new to Python and therefore my error-solving skills are not much yet developed. I am using Python within a geoprocessing script which is supposed to use ogr (reading/writing shp) and ...
13
votes
4answers
887 views

Is there Python library (other than ArcPy) for geoprocessing such as buffer?

Excluding ArcPy, is there any python library which can do geoprocessing, such as buffer/intersect, with shapefiles?
2
votes
2answers
159 views

Python Def Query Help for multiple layers

I have Three layers in a .mxd, all three layers have a common value I can use, but a different Label in each Layer. As an example, the Value I want to use is "100" In Layer A, the Value is in [Name] ...
0
votes
1answer
43 views

Access atributte processing algorithm

I have a doubt. In my plugin I use algorithms from processing sextante. For example: Processing.runAlgorithm("grass:v.to.rast.attribute", None, inputLayer, 0, Indexes, extent, cellSize, -1.0, 0.0001, ...
2
votes
2answers
249 views

How to programmatically change raster symbology after reclassification?

I have created a code in Python that I will use for a custom tool in ArcGIS, the code will create a Eucledian Distance of 6000m around a point and Reclassify the distance from 0-2000, 2000-4000, ...
1
vote
1answer
153 views

How to remove all selection from all registered layers using QGIS plugin?

I want to remove all selection from registered layer in QGIS using Python. I tried to clear the map canvas using: self.iface.mapCanvas().clear() self.iface.mapCanvas().refresh() but the ...
-1
votes
2answers
326 views

Export MXDs files to PDFs using Python [closed]

I'm trying to write a python script that will export multiple MXDs to individual PDFs while using a feature class field to rename the pdfs (this can be an optional field, if not check it can copy the ...
3
votes
1answer
151 views

Creating a polyline from point data that represents multiple linear features in ArcGIS 10.0

I have a problem where I have to somewhow create a polyline feature class in ArcGIS 10.0 from points that were collected in the field using a Trimble GeoXT that represent the start and end of multiple ...
2
votes
1answer
117 views

How can I delete a shapefile using OGR?

In my QGIS Python plugin, I use shapefile layers and I am having a problem rewriting existing shapefiles. Is it possible to delete a shapefile from disk using OGR?
3
votes
1answer
172 views

Is there a method to write feature class attributes and counts to an excel workbook in Python? [closed]

I have a feature class with 3 fields that I would like to reference later in an excel workbook. They are all represented in 3 different maps. Essentially, I would like to show the the attribute ...
1
vote
3answers
577 views

How to install Fiona to read Shapefile attributes with OSGeo4W?

I´m developing a plugin in Python and I need to read the shapefile attributes, so I found the Fiona API and dbfpy also but I don't understand how to install these packages because I install the QGIS ...
3
votes
1answer
452 views

How to calculate angle of polyline at its midpoint using Python/ArcPy?

Trying to calculate the angle of a line at its mid point using python; this will be used to display flow direction on a water network. I've developed this script, which works in terms of generating ...
0
votes
1answer
113 views

How do I use gdal_proximity.py from the QGIS python console?

How do I run gdal_proximity.py from the QGIS python console?
1
vote
2answers
100 views

How to read arc/info e00 vector files (no binaries) with Python?

I can easily read e00 files with QGIS and it seems as if in older versions of ogr there was driver support for the arc/info e00 file format. Nowadays that seems to be deprecated, as running ogrinfo ...
1
vote
1answer
37 views

which feature of toolboxes will be appropriate for building a groundwater model in Model Builder [closed]

I am completely new to ArcGIS Model Builder and also Python scripting. However, I want to build a model to automate groundwater recharge.
3
votes
1answer
77 views

How to Create Feature Layers and Search by Location for all Feature Classes in Geodatabase?

I'm very new to python, but I'm having trouble finding the answer on my own. I need to loop through a given file geodatabase, select any features that intersect a project polygon and then search the ...
2
votes
2answers
587 views

How to merge dbf files in Python or arcpy?

I have over one hundred dbf files to merge. Each of files have two columns: ID and another field which differs from one file to another. I want to merge those fields based on ID such that each raw ...
0
votes
0answers
43 views

Import processing in qgis 2.0 [duplicate]

I know that this question has already asked but no concrete answer has given!! My environment is Ubuntu 12.04 and I'm using eclipse-pydev as IDE. Thanks in advance for helping me.