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

learn more… | top users | synonyms

2
votes
1answer
26 views

Are the functions in OGRPolygon accessible through the python bindings?

I'm currently trying to use the OGR python bindings to process some shapefiles. I want to obtain the number of interior rings in a polygon feature. Unfortunately I'm unable to use the documented ...
0
votes
1answer
24 views

Changing band for greyscale in plugin

I am trying to make a qgis plugin to change which band in a multiband data set (netCDF where the band represents time steps) is used for a grey scale rendering. The file works fine with manual ...
2
votes
1answer
72 views

What is causing sr.lock on tables after looping?

The following code puts an sr.lock on each table in my List. What’s causing my tables to lock up? I understand my script is reading or opening my tables temporarily to perform the ...
3
votes
1answer
639 views

Can ArcGIS Desktop 10 Add-in Use IronPython?

Coming from the same background as the original poster in this thread, I wonder if anyone has had any success creating an Arc10 Add-In using IronPython. I have been able to access ArcObjects via ...
-1
votes
0answers
23 views

How to return value into a python list using search cursor

I would like to retrieve the temporary value which are done from searchCursor. I want those values to be stored inside an array (preferably a 2D array, as i have to store objectid,x,y , also there is ...
0
votes
0answers
13 views

Gdal setGeoTransform error

I am using the raster_stats program in python to calculate zonal stats. Raster_stats seems to heavily depend on gdal, and I am running into some trouble: Gdal does not seem to be open the tiff file. ...
2
votes
2answers
44 views

Adding layer into ArcMap via Python - .pyt versus .py

In the final step of a script I've built, I'm trying to add a layer into an empty blank map document. This is my block of python code below that adds the layer. Everything works fine if its run from ...
0
votes
1answer
72 views

How to get from Lat/Lon to this format?

I have twitter data with coordinates such as: [-7.2377761, 112.73091137] I'm working with a python geo library called osgeo. The sample code indicates creating a point like this. point = ...
0
votes
0answers
17 views

MODIS images set CRS and reproject

I am developing a plugin which reads MODIS images, and I know that MODIS images are in sinusoidal projection and I need to set that CRS and project the image to WGS84 (epsg 4326) in python. I search ...
1
vote
1answer
47 views

Multiple arcpy.env.workspace

thanks in advance. Is possible to set multiple env.workspaces on the same script to listDataFeatures from different spaces ? eg. import arcpy def readFromGdb(): arcpy.env.workspace = ...
1
vote
0answers
27 views

How to access annotation feature classes in ArcPy?

I want to batch replace paths in a series of .mxd files using Python. Many of the layers have moved and in some cases the name has changed or its dataset is different. I've written this code which ...
0
votes
0answers
20 views

What is the Python numpy equivalent of the IDL # operator? [on hold]

I am looking for the Python numpy equivalent of the IDL # operator. Here is what the # operator does: Computes array elements by multiplying the columns of the first array by the rows of the ...
0
votes
1answer
34 views

Conducting geographically weighted regression on a raster

I have a relatively big raster file on which I want to conduct geographically weighted regression. Size of raster ~ 2 GB and number of rows is around 100,000 One way might be to convert from raster ...
1
vote
4answers
248 views

Offline Python or C++ library for plotting locations on map?

I'd like to plot locations using longitude and latitude coordinates using Python or C++, is there a good library for such a task? I know that matplotlib is an option, I'm wondering if there are any ...
0
votes
0answers
17 views

custom toolbar combobox: issues with adding functionality

I've added a combo box to my custom toolbar in QGIS (based on this thread QGIS - Add a combobox to a toolbar), but it doesn't populate unless I reload the plugin. def __init__(self, iface): ... ...
17
votes
2answers
3k views

Visualize shapefile in Python

I was searching the internet to see if it is possible to visualize geographical data in Python, without always opening ArcGIS and make a map (because I have a lot of scripts that uses arcpy). On the ...
4
votes
2answers
64 views

Bulk convert DBF to CSV in a folder ArcGIS 10.1 using Python

I would like to convert 1000 dbf files to CSV. All dbf files are in one folder and they have sequential names (S:\output_tables\tcb1.dbf, S:\output_tables\tcb2.dbf, S:\output_tables\tcb3.dbf, up to ...
4
votes
1answer
212 views

How to read BMP file location of image used for picture symbol in LYR file?

I have a number of *.lyr files which are pointing to various .bmp files which are used as marker symbols in ArcGIS for Desktop 10.1 I was wondering if there is a way to extract the file paths of the ...
1
vote
1answer
74 views

Load and display a layer using PYQGIS

I'm having a go at using pyqgis from within the QGIS python console to load a layer from SQL Server and display it. I feel like I'm part way there but I'm having a real issue getting the layer to ...
6
votes
2answers
686 views

How to access Esri ArcPy modules from Enthought Canopy?

I have ArcGIS 10.1 running on my windows system and I have also installed the new 32-bit Canopy Express Enthought Python Distribution. Is it possible to load and use the Esri ArcPy modules from ...
-1
votes
0answers
33 views

I am trying to clean up my data that I created but it is not stripping anything [on hold]

I am trying to strip <br> among other things but when I print it out or look in my text file, nothing happen. The code runs without any error but it will not strip <br>. import urllib ...
1
vote
0answers
36 views

How can a script tool share (dynamic) variables among different modules?

I'm running a python script from the toolbox window (as a script tool). I have a second python (tkinter) module that I use as an input interface. Now, I know that the script tool can call the ...
0
votes
0answers
14 views

runCommand in pymongo

I run the following query on my mongoDB console: location = db.BLR_all.findOne( { $and: [{"geom.type":"Point"},{"REGION": "KORAMANGALA"},{"E_NAME": "RAILWAY BOOKING CENTER"}] }) db.runCommand({ ...
0
votes
0answers
12 views

QgsGeometryAnalyzer.dissolve problems

I am completely new to the QGIS python api and I am running into an error which I cannot solve when trying to use the dissolve class. I used the basics of the PyQGIS Cookbook. In my understanding ...
0
votes
1answer
19 views

USGS Earthquake GPS Metadata: Buffer Zones & Python

I'm making a python web crawler that gets USGS earthquake GPS data, and I'm wondering how I should process the latitude longitude pairs to see if it falls within a specified radius of a specified GPS ...
3
votes
2answers
117 views

Converting Vertices of Polylines and Polygons to Points and Maintain Attributes

I'm pretty sure someone has done this before, but I'm having no luck. I'm using ArcGIS Standard version 10.2.1 and I want to convert all the vertices of a polyline or polygon to points. Essentially, ...
3
votes
1answer
185 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 ...
1
vote
1answer
38 views

Problem with Intersect_Analysis : too long path? [on hold]

I made a python code for Arcgis 9.3. to intersect 2 features. The problem is that code works when the files are on my desktop (for example) but not when they are in a long path on another disc. Here ...
0
votes
2answers
55 views

using Python to calculate NDVI, output as a Geotiff

I need a script that can calculate NDVI from two separate input Geotiff files, then output the results as a Geotiff. I wrote following script, most of which is borrowed from various on-line sources ...
0
votes
0answers
45 views

Issue blocking QGIS feature form dialog with Python

I'm not sure where I'm going wrong with this python logic for a custom form in QGIS 2.0.1. There are a few things required by the validation function: that index of combo boxes aren't 0 (first index ...
2
votes
2answers
43 views

Shapely: Round Polygon Corners?

I use the python module "shapely" to make Polygons (like below). Can I convert the sharp edges of a polygon easily to round edges? Such that when I have unified some polygons I could issue a command ...
3
votes
3answers
134 views
+50

Is there a way to call the clip function in pyQGIS from the python console?

Is there a way to call the clip function in QQGIS from the python console? It is found under geoprocessing tools in the vector menu.
0
votes
2answers
23 views

How to plot geo-data using matplotlib/python

I am trying to plot a polygone on python, using different libararies, but no one of these worked with me. I tried vincent ,Shapely , .. and now matplotlib. I don't wanna use softwares like qgis I ...
1
vote
2answers
218 views

Where to find PySAL toolbox for ArcGIS?

I installed PySAL but i can't find the toolbox for ArcGIS.
0
votes
0answers
15 views

Error while running OSGeo4W setup

i'm not sure if i got a problem with osgeo4w or with python. but i get an error message if i run setup: C:\>setup C:\>Exception in thread Thread-5: Traceback (most recent call last): File ...
2
votes
2answers
69 views

Using Python to shorten polylines of varying lengths by 44% of their original length (or by a value contained in a field)

I have a feature class containing tens of thousands of polylines of varying lengths that were constructed from only a start and end point (of note, they are all at different angles, and many lines ...
1
vote
1answer
60 views

Using 'construct points' on all lines in a shapefile (arcpy)

I need to use the editing tool 'Construct Points' on several shapefiles that each have ~1300 polylines. I need to do this to create points every 1km along each of the polylines, which represent the ...
0
votes
0answers
15 views

QgsMarkerSymbolLayerV2 not rendering

For the life of me I cannot get a custom vector layer symbol to render. Following is the code I am using, as fas as I can tell renderPoint is never called. Is there something I am missing here. The ...
0
votes
1answer
98 views

Calculating Stream Length-gradient Index (Hack Index) with the field calculator

I'm trying to calculate the Stream Length-Gradient Index of a stream (example data below). Just started to get into python, but am struggling with a solution to this problem. I have 42 streams to run ...
1
vote
0answers
31 views

Managing large number of catchments/watersheds

Does anyone know of an easy way to manage a large number (10,000's) of catchments/watersheds? I have defined a stream network and for each segment, I have a corresponding catchment (in a unique ...
7
votes
1answer
662 views

How to prompt for user input during ArcGIS Python script tool execution?

I want to prompt for user input after all parameters have been specified for the script tool. I've seen many forum posts and stackexchange questions about this, and they all conclude that it's ...
0
votes
1answer
426 views

How to clip raster by multiple polygons in multi rasters?

Using QGIS, I want to clip a raster by multiple polygons contained in a single shapefile. I read that gdalwarp can clip my raster by multiple polygons BUT the output is a single merged clipped raster. ...
3
votes
3answers
351 views

Python - Find the largest extent in a list of extents (tuple format)

I am trying to find a way (simplest is the best) to retrieve the largest extent in a list of tuple extents in python. The list is looking like that: extents = [(-180.0, -90.0, 180.0, 83.624), ...
3
votes
0answers
52 views

After ArcGIS 10.2.1 update, Arcpy 64 bit import Error

I've updated my ArcGIS desktop version from 10.2 to 10.2.1 and have noticed that when I run the 64 bit version of IDLE I now get an error when trying to import arcpy: Python 2.7.3 (default, Apr 10 ...
0
votes
1answer
51 views

Error with Python Script tool for ArcGIS 10.2

I am trying to create an ArcGIS map tool that includes creating TINS and uses parameters. This tool works fine when taking the data from shapefiles, but when I use map layers, which is what I want it ...
0
votes
2answers
135 views

How to handle adding a PostGIS layer in pyQgis without saving password?

I'm writing python plugin and trying to find the right way to add PostGIS layer on the map without storing user password. After adding layer on the map, I strip out the password from uri like this: ...
0
votes
1answer
22 views

How do I check spatial reference on all parameters during Tool Validation?

How do I check spatial reference on all parameters during Tool Validation? Just looking for recommendations. Here is what I have already. This must work with existing validation. import arcpy class ...
0
votes
0answers
11 views

ogr: confusing results from `SetSpatialFilter()`

My layer is derived from a data source like this: l_131 = bounds.ExecuteSQL("select * from 'nam_l' where 'ND_5'= 131 ") feat = l_131.GetNextFeature() feat.GetFeatureCount() >>> 200 It is a ...
0
votes
1answer
15 views

Point z value Return 1.#QNAN while set before

I am makin a python code for ArcGis 9.3. The code is as following : rowsLine = gp.updatecursor(line_Feature_Class) count = 0 rowLine = rowsLine.next() rowsPoint = ...
0
votes
1answer
35 views

How to copy attribute values of fields in selected features of one layer to another Qgis programmatically?

I am trying to get the values of attributes of the selected features of a layer field by field and copy to another layer that I created in qgis with pyqgis. Is here a example for this. Every example ...