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

learn more… | top users | synonyms

0
votes
1answer
34 views

Python buffer in a line using GDAL

I am trying to make a buffer from a line using gdal. I use the example in the gdal Cookbook import ogr, os def createBuffer(inputfn, outputBufferfn, bufferDist): inputds = ogr.Open(inputfn) ...
0
votes
1answer
25 views

With QGIS Plugins/PluginBuilder, how to prevent 2nd instance of Plugin from starting

I am using QGIS 2.6.0, with PluginBuilder 2.0.3 [checking the version, I just noticed that the 2.1.0 update is available] I am writing a plugin; it installs and runs. While running, I am able to ...
0
votes
5answers
54 views

Aligning Raster Over the Polygon

I have a raster image which have to be aligned over the polygon. Both the raster and polygon have the same coordinate system. The figure shows the raster image which has to be fitted over the RED ...
1
vote
0answers
42 views

Generate random points in polygon. Algorithm question

i created a Random Point Generator in python using the algorithm described here by @whuber. The algorithm is implemented using Shapely, PostGIS and psycopg2. To boost performance pythons ...
1
vote
1answer
64 views

Computing intersections for each geometry in a table

I have a table with many Linestrings and for each of these Linestrings I need to figure out which other Linestrings, from the same table, intersect with it. If I recall correctly this gives me a ...
0
votes
2answers
15 views

Error with layer.pendingAllAttributesList

While coding to obtain individual layers' attributes (field) list, I am stymied by the code. I can identify a specific layer: MyLayer = QgsMapLayerRegistry.instance().mapLayersByName("TestPoint") ...
0
votes
0answers
21 views

Python script to get count of features that meet a certain criteria [duplicate]

I am in search of a Python script for use in the ArcGIS Field Calculator to return the number of features that meet a certain criteria. Here's where I am getting stuck: def ...
0
votes
3answers
45 views

Empty shapefile after project tool in a for loop

I am running a for loop to process a years worth of data. The entire script runs fine for the first run through, but when it runs again (when date is 1/2/2013), I get the following error: 'NoneType ...
-1
votes
1answer
49 views

Is there a way to execute tools based on the names of feature classes or raster names?

I would like to execute Zonal statistics as a table on two different raster layers that share a common element in their name. For example: one layer is called x_1980, and another layer is called ...
1
vote
2answers
94 views

QGIS Python Script - Routing along Waypoints [closed]

I used Anita Graser's script point_layer_to_route.py which worked like a charm until I updated to 2.6. With QGIS 2.6 I always get objects without any features. Can anybody tell me if he/she had the ...
1
vote
0answers
56 views

Splitting Line.shp at Point.shp with Python/ogr

I'm trying to modify some ESRI Shapefiles using Python with gdal/ogr module. What I want to do is quite simple, but I didn't find any solution by now. I have two shapefiles: (1) Lines.shp and (2) ...
0
votes
0answers
99 views

Python script to get feature count in a feature class that fall in a specific range

I need to write a Python script to be used in the ArcGIS Field Calculator that will return a feature count for values between a range defined by the values in two other columns. Here is a graphic ...
1
vote
1answer
46 views

Using GDAL's GetProjection information to make a coordinate conversion in pyproj

I'm opening a geoTIFF file in Python using gdal. Upon reading with the GetProjection() method, I find the following information ...
1
vote
0answers
66 views

With QGIS, why use QT Designer tools for creating Slots/Signals/ etc, if plugin coding can do it alone

I am curious why there is facility within QT Designer to create signals and slots as, to my surprise, I did not need to do this. All of the necessary coding was accomplished completely within the ...
-1
votes
2answers
56 views

How do I import geos from shapely? [closed]

I clearly have geos installed under shapely, since I downloaded "Shapely-1.4.4.tar.gz". Also, the result can be seen in my directory in the correct path: ...
1
vote
1answer
71 views

How to label line features using python code?

I used the following code to label the line features(roads) in a layer.It works in the console, but not by python code(application) It works for the points too. What did I do wrong? Any help would be ...
1
vote
0answers
19 views

Python Band.SetNoDataValue(), sets all bands at once

Can someone tell me what I am doing wrong? I want to set bands 1 and three to 255, and band 2 to 0. The code below only should only set band 2, but gdalinfo shows that all bands get set to 0. Ubuntu ...
0
votes
1answer
54 views

How to add mdb geodatabase layer (feature class) to QGIS project using python?

I want to add a feature class of a personal geodatabase mdb to my qgs project by code (a plugin I am working on). I am using a command similar to that used for adding shapefiles, but this is not ...
0
votes
1answer
41 views

GPX to shapefile tool error message

I downloaded the GPX to shapefile tool and when I use it I get the following error message: 1 No module named re Failed to execute (gpx2shp).
0
votes
1answer
25 views

How to reference a return value from openProject macro?

It is very good to have available functions on startup.py, I created one to get the qgs project base name and referencing it as a Python expression on the composer thanks to all the information found ...
2
votes
1answer
50 views

Determine spatial average of several tiff files

I am relatively new to GIS. I have a set of tiff files containing a raster each. I would like to average them, though their extents are slightly different. They each have their geospatial data ...
2
votes
2answers
50 views

ArcGIS are two rasters the same? - including null values

I am working on a task to calculate Height Above Nearest Drainage (HAND) - that is the height above the nearest point along the flow path that is on a drainage - not the geographically nearest ...
1
vote
0answers
23 views

How to find QGIS or QT or Python object definitions

I am attempting a simple plugin, on QGIS 2.6, using the available QT Designer installed I have successfully loaded a plugin, and can display a dialog box with widgets, within, and now attacking ...
0
votes
1answer
58 views

How to set feature coordinates to values in attribute table?

I have some shapefiles that were produced programatically, and everything came out okay EXCEPT that the geometry information was not written correctly. The coordinates for each feature are null. ...
2
votes
1answer
63 views

Is it possible to render a large number of shapefiles to a pdf document using Python?

I'm extremely new to GIS, and recently made a map by loading a bunch of shapefiles into QGIS using a python script. However, it took 15 mins to scroll in or out on the image, and the pdf export ...
3
votes
1answer
41 views

QGIS using the heatmapplugin from the console

I have to make a lot of heatmaps from csv's. Therefore I'm making a python script to run in the console. So far I can load csv's and save them as shapefiles. To get to the heatmapplugin I'm using the ...
1
vote
1answer
40 views

Qgis Python console print statements not working

I have a small problem with the Python console in Qgis. I am working through some introductory tutorials on Python scripting for Qgis. I have a script that loads layers, then queries the canvas for ...
0
votes
1answer
23 views

Data frame index

Can anyone know how to make index ,in arcpy, for a several data frame in one mxd? That question related to this question : Insert layer file to specific data frame
1
vote
1answer
59 views

Calculate value from an equation using Field Calculator Python/VB Script

I wanted to calculate a result value from 3 fields using an equation. VBScript or Python codes are also accepted..:-) the equation is RESULT= [(R^2/3)(S^1/2)]/n..
0
votes
0answers
47 views

Fiona write crashes

I am trying to write a new shapefile with fiona but after creating the features, i keep getting this output after the program crashes: The program '[6668] python.exe' has exited with code -1073741819 ...
1
vote
1answer
58 views

Using if else statement in Python Parser of Field Calculator in ArcGIS for Desktop?

I need help in writing the python script in the field calculator. I have three fields namely: CODE COMPLEX Map1 Map1 is an empty field that I want to populate. I have a number of conditions to cater ...
1
vote
3answers
68 views

Determining Y coordinate for Create Fishnet from desired Angle of Rotation in Python/ArcPy?

On the ESRI website it says: How_Create_Fishnet_works Calculating a value for the y-axis coordinate If you know the angle of rotation, you can compute a value for the Y-Axis Coordinate parameter as ...
-1
votes
1answer
52 views

What application server or web framwork to use

I'm looking to make a webmapping app, which gonna use Geoserver as carto server, and Postgres/postgis as Dabatase, and Extjs as client UI. but i'm in dilemma in application server side, between PHP, ...
1
vote
0answers
35 views

ArcGIS script for mapping lat/long coordinates to boxes/rectangles? [duplicate]

Working on a project that requires me to take lat/long coordinates and map them as rectanglular boxes on ArcMap 10.1. To be clear, the upper left & lower right corners of each box/rectangle are ...
1
vote
3answers
120 views

Field Calculator - How to evaluate and sum multiple fields?

I'll do my best to describe the problem - my main issue isn't so much the python code but rather the logic I'm using. The file I'm working on is a polygon shapefile with forest attribute data. In the ...
-1
votes
3answers
68 views

Insert layer file to specific data frame

I have a folder that contain mxd's projects. Each mxd has 3 and more data frame. I want to insert layer file to a specific data frame with position in the TOC. I don't know how to do it. I'm trying ...
3
votes
1answer
149 views

Export Model to python script in QGIS 2.6?

I just wanted to ask where the export model to python script option has gone in QGIS 2.6.0? Thanks
0
votes
1answer
82 views

Calculate Field based on two fields using python

I'm trying to calculate new values for a field based on two other fields. In VB I don't have any problem, but I need to use python to publish my gp service.
0
votes
1answer
50 views

Get shape file polygon attribute value at a specific point using Python (e.g. via PyShp)

I have a shape file comprising multiple polygons. These polygons have attributes. I am trying to write a script in Python that takes a co-ordinate point, determines in which polygon it falls, and ...
0
votes
2answers
113 views

Convert shapely polygon coordinates

I am trying to work with a shapefile using shapely, fiona and python. The original coordinate system is in latitude and longitude that I am trying to convert to state plane system. So I want an ...
2
votes
1answer
101 views

How to create a Qgis python script to manipulate fields with some parameters?

I'm just beginning with QGIS. I have a shape file with 10 fields field1, ..., field10, and many thousands of data. I will like to automatize the next sequence (in a python script or a model): load ...
1
vote
0answers
68 views

Link QGIS to Anaconda Python Distribution: Spyder, iPython Notebook, pip, scikit-learn

I have Anaconda as my primary Python distro, and want to route Python related QGIS scripts through it. With Anaconda, I have Spyder, can easily install packages with pip, and can launch a iPython ...
2
votes
0answers
83 views

Matplotlib error when installing Molusce or lifemapper in QGIS Brighton

I am installing plugins via the QGIS desktop internal interface, and have had twice now messages associated with matplotlib. The first error was for something called lifemapper and now for MOLUSCE. ...
0
votes
1answer
68 views

Transform lat long to state plane coordinates

I am trying to convert a set of lat long to state plane coordinates using python and pyproj. The location is Tennessee and this gave me information about the central meridian, lat origin and the proj ...
2
votes
1answer
122 views

Convert GeoPDF with GDAL

I'm attempting to convert a USGS US Topo GeoPDF in Windows. I'm using GDAL 1.11.1. My initial attempts were with this Python script, which automates the process by feeding a command to the Windows ...
1
vote
0answers
20 views

How do I make arcpy exclude frozen / off layers while importing a DWG file?

I'm attempting to update existing GIS feature classes (SDE) using master AutoCAD files but end up importing ALL features present in the AutoCAD drawing regardless of the visibility settings (frozen / ...
1
vote
1answer
231 views

How to fix python ImportError: DLL load failed: The specified module could not be found?

During import fiona, I am getting following error. Error is different from other user so I asked this question may be it is repeated. import fiona Traceback (most recent call last): File ...
3
votes
1answer
48 views

How to filter QGIS layer from python?

Using QGIS 2.4 python console, I'm trying to display only a subset of a layer features. I've managed to get the features both from the layer : featuresIterator = ...
2
votes
2answers
79 views

Python Add-in- Message Box to display area of selected polygons

I am looking to create a Python AddIn which calculates the area of selected polygons. I would like to be able to select the features, click a button on the toolbar, and a Message box displays the sum ...
2
votes
1answer
44 views

How to add documentation for QGIS Processing algorithms?

In the Processing modeler, many of the algorithm help tabs say: Sorry, no help is available for this algorithm. In the QGIS sourcecode, the processing algorithms seem to reside in: ...