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

learn more… | top users | synonyms

2
votes
1answer
11k views

Python :ImportError: DLL load failed: The specified module could not be found

I am working on Python plugins for QGIS. I set my variables as PATH :=C:\OSGeo4W\apps\qgis;%PATH% PYTHONPATH:=C:\OSGeo4W\apps\qgis\python But when I try to run my .py file in IDLE I get an error ...
2
votes
1answer
154 views

Locate DTEDs from one layer that intersect a polygon in another layer

I'm new to the GIS world, and using ArcGIS 10, so please forgive me if this is a simple question. I have DTED files (level 2) that I have placed into a mosaic dataset, and I'm trying to determine ...
2
votes
1answer
447 views

Search Raster Files from Folder that Have Same Spatial Coordinates Using Python

I have approximately 700 raster files in a single folder and I need to find files that have the same spatial extent and copy to a different folder. The raster files measure daily snow cover and ...
2
votes
2answers
809 views

Convert CSV files into OSM with FME

I have a database which i've exported as individual csv files for each table. Below are some of the attributes which exist from two of the csv files: wayPointID linkID order x y z length ...
2
votes
1answer
558 views

How to determine area of pixel in meters with GDAL and Python?

I have a raster loaded in Python using GDAL bindings. I'd like to be able to determine the area of a pixel in meters although I'm not confident that the projection is in meters. On this page I see a ...
2
votes
2answers
1k views

Mapnik TextSymbolizer showing nothing above OpenStreetMap base layer

I'm trying to use Python to create a TextSymbolizer to display a trail name above the trail LineSymbolizer. Below this layer is the OSM base layer which contains its own data for that trail. I can ...
2
votes
1answer
3k views

How to update feature class by iterating through values with branching?

I'm really struggling with getting this to work. Basically, I want my script to get the "newID" value and use that as a look up value. If the "newID" is found in the OldID list then do one thing, ...
2
votes
1answer
582 views

How do I group layers in Mapnik?

I might be thinking about this all wrong, but right now I'm using Mapnik's OGC Server, and using that WMS with OpenLayers. How would I group multiple layers (say country, water, state borders) into ...
2
votes
1answer
513 views

Accessing MPS Atlas from Python with ArcPy?

I'm having trouble finding documentation on accessing MPS Atlas features using python in ArcGIS 10. I need to be able to modify dataframe manager properties, swap map sheets, etc. Is it part of ...
2
votes
1answer
31 views

QGIS Python variable not updating after new features are inserted

I have the following script that sets the a feature id automatically after a new feature is digitized. I added the function inside the project's Macro section inside openProject() function: The ...
2
votes
1answer
49 views

How do I use geometry object in processing.runalg()

I am trying to clip a polygon (large road network) with every row in another polygon (district polygon) using PYQGIS. layer_adm_level = QgsVectorLayer(base_path + adm_level + ...
2
votes
1answer
35 views

Parameters for osm2po web service to route for walking

I have started the osm2po web service using the jar file. In the configuration file, I could see different parameters related to walking but not sure what each one does. I am trying to call the web ...
2
votes
1answer
90 views

Accessing GPS from QGIS 2.14.1/Python 2.7 /Windows10

I would like to access the device described at QGIS live GPS tracking /recommended hardware (GPS USB stick) via QGIS/Python. A gps module does't seem to be part of the standard installation of python ...
2
votes
2answers
111 views

Using zoo-project WPS service in QGIS WPS-Client

I've created a python wps service in the zoo-project framework, which is used to calculate a Line of Sight based in on a start point, an end point and a start point height. The service works fine if i ...
2
votes
1answer
71 views

How to use QGIS advancedpythonfieldcalculator from the console?

I'm trying to use the field calculator in a script like so: processing.runalg('qgis:advancedpythonfieldcalculator', output_layer, 'Latitude',1,12,5,'','$y',output_layer2) Not sure exactly how to ...
2
votes
1answer
136 views

Adding QGIS-specific Python interpreter to Eclipse?

I was following the steps from QGIS Python Programming CookBook to add qgis interpreter to eclipse, however I went into the following error in step 8: "See error log for details. No output was in the ...
2
votes
1answer
70 views

Bulk loading into pyrtree index

I'm using pyrtree to create an index for a point in polygon operation. I am currently trying to insert 1.8 million rows into the index and it takes more than an hour to do so. I am unable to use rtree ...
2
votes
1answer
151 views

Installing python xlw and xlrd libraries for QGIS on Mac OSX with Python 2.6

I am trying to use the XYtools plugin for QGIS (because copy-paste is not working with just one of my files?!), and I'm concerned that I actually just need to update my Python but not sure if doing so ...
2
votes
1answer
39 views

How to propagate attributes down several line features?

I have a PostGIS database of road features which are split at intersections. Some of the features on an individual road have certain attribute info (i.e. speed limits) and others do not. I want to ...
2
votes
1answer
60 views

Why is QgsFeatureIterator returning bad data?

This is a spin-off of another question I asked previously, but it has grown in scope and deserves its own thread. While iterating over a vector layer (shapefile) I included the following ...
2
votes
1answer
107 views

Capturing Output Messages from GRASS when Running Python Scripts

Thanks to the excellent documentation here: https://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Python:_GRASS_GIS_7 I've figured out how to access GRASS modules in ...
2
votes
1answer
68 views

Using Python to convert line shapefile to raster, value=total length of lines within cell

I have already read the similar question Convert line shapefile to raster, value=total length of lines within cell using R. And I want to realize the function using Python. ===== My attempt ==== ...
2
votes
1answer
79 views

How to get perpendicular line script to work?

I'm trying to get this script to work by @gene but I'm not sure how to load the results into QGIS. I tried to make a memory layer but not sure how to add the geometries of the point, line and the ...
2
votes
1answer
106 views

Using Proj.4/GDAL to convert lat,lon to i,j

I'm working with a data set in GRIB2 format and need to determine the grid cell index (i, j) corresponding to a given lat,lon. I have the projection definition in the form of projparams as follows: ...
2
votes
1answer
73 views

Polygon split with defined area

I have polygons with interpolated data like on the picture on right. Now I want to split this polygon into smaller polygons with predefined similar area. Positions of these smaller polygons must be ...
2
votes
2answers
89 views

landsat-util zip files

I've just started using landsat-util and am having a couple of problems. First of all, the standard download command only downloads Bands 4,3,2 (the visible bands) and the QA band. In the docs it says ...
2
votes
1answer
143 views

What is a convenient way to write OSM data to a .shp file in python

I wish grab OSM data that is within a specified bounding box and matches specific key/value combinations. I then want to write this to a .shp file for further processing using, probably, the QGIS api. ...
2
votes
1answer
67 views

Determining proportion of raster cells containing each value from list for many rasters in raster stack?

I wrote a function to determine the proportion of raster pixels that contain each of a list of values that I would be interested in. I then wrote a function to apply the previous function to a 3d ...
2
votes
1answer
275 views

Import GDAL Error

I'm trying to import GDAL to run in 64-bit spyder and am getting the following error: import gdal Traceback (most recent call last): File "<ipython-input-1-27bf4694dd2b>", line 1, in ...
2
votes
2answers
91 views

How to make change to layer in ArcMap with python/ArcObjects?

In ArcMap 10.1 from the python window I am attempting to rotate a symbol for a point. After I run my code I can look at the symbol properties and the rotation expression is set on the symbol, however ...
2
votes
1answer
194 views

How to use multiprocessing or pool to boost up the performance of ArcPy script

I created some arcpy script which actually runs slow on huge dataset. such as 100000 feature in it. I read from below path that multiprocessing can boost up arcpy script script performance. ...
2
votes
1answer
120 views

Loading *.adf files into QGIS using Python

I am trying to write a loop to load .adf files into QGIS and create a contour map from each one. The response to an older question about loading .adf files (here: Loading *.adf files into QGIS?) was ...
2
votes
1answer
103 views

Getting list of QGIS field names, not including hidden fields using PyQGIS

Currently, for a python plugin for QGIS 2.8.3, I get the list of fields for a layer using pendingFields as mentioned in this thread: fields = self.layer.pendingFields() I now have a few hidden ...
2
votes
3answers
302 views

-9999 (no data value) becomes 0 when writing array to GDAL memory file

I am trying to reproject and resample (1000m ->> 30m) a raster image (shape 238X406) using gdal.ReprojectImage() function in Python. The input file has -9999 cells as no data value. The result is an ...
2
votes
1answer
216 views

Python-gdal create geotiff from array with colormapping

I am creating grayscale, single channel geotiff files from numpy arrays with the below module, but I would like to apply a fairly standard colormap to the data. I've tried three channels of R,B and G ...
2
votes
1answer
124 views

pyQGIS changing Paletted Raster Layers to Grayscale

I've written a plugin which imports a number of colour geoTifs (map tiles) and works correctly but it would be great to display these as Grayscale after loading in. The geoTifs load as paletted ...
2
votes
1answer
423 views

How to calculate zonal statistics from multi-band raster for each polygon using python?

I want to calculate the zonal statastics from multi band raster for a polygon layer. When I am using this snippet of code: vectorlayer=qgis.utils.iface.mapCanvas().layer(0) rasterfile = ...
2
votes
1answer
116 views

Processing algorithm fails from Python script

I'm trying to write a Python script performing a geoalgorithm. What is surprising me is the following: I first test the algorithm by QGIS (2.8) interface. In my case, the GRASS interpolator ...
2
votes
1answer
88 views

Looking to find (or build) a particular Python geoprocessing tool

So here is my situation: There is a large area (a wildlife refuge) of nearly 200,00 acres that we have loads of spatial data for, from habitat management projects from the past several years. My boss ...
2
votes
1answer
264 views

Python: how to set a different output folder

I want to transform some vectors to rasters in my folder but I have difficulties setting the output folder. The following code only allows me to output to the original database. I hope to output all ...
2
votes
1answer
87 views

Landsat Surface Reflectancce product Python packages

I have to work with numerous Landsat surface reflectance product that I downloaded from http://landsat.usgs.gov/CDR_LSR.php. The product comes with a QA data with information on clouds and shadows ...
2
votes
1answer
274 views

How to create a plugin GUI for QGIS 2.8.2?

I create a pluging with the pluging builder in Qgis 2.8.2. I went to the folder of my pluging : C:\OSGeo4W64\apps\qgis\python\plugins\yu in order to visualize al the files that the pluging builder ...
2
votes
1answer
2k views

Interpolation grid for scattered data having (latitude, longitude) coordinates

I've got some scattered data in the form of (latitude, longitude, someParameterValue). I'm using inverse distance weighting interpolation method to interpolate them in a rectangular grid of pixels. ...
2
votes
2answers
414 views

How to create a line between a point and nearest neighbour using python (template included)

I have 2 shapefiles - one is a series of points, the other is a polyline. I want to draw a straight line between each point to the nearest point on the polyline. This question has already been asked ...
2
votes
1answer
48 views

What's the syntax to skip optional saga:catchmentareaparallel parameters?

In PyQGis, I want to use saga:catchmentareaparallel algorithm, in the parameters there is an optional arguments, and I don't want to use them, what is the value should i put on the argument? i try to ...
2
votes
1answer
272 views

Identifying Left and Right Mouse Button Clicks in PyQgis application

I am relatively new to PyQt. I am trying create a custom plugin for Qgis which enables the user to select some features by drawing polygon on the canvas using mouse clicks and then performs ...
2
votes
1answer
278 views

Unable to compile using make test in Linux

While trying to compile my test plugin I encounter this error, for the moment I can't figure out why, last week I had some issues on windows but eventually solved them via OSGeo Shell but this time ...
2
votes
1answer
151 views

Setting Two Definition Queries as Parameters in Python Script tool causes: RuntimeError: LayerObject: Set attribute definitionQuery does not exist

I created a script that adds definition queries to every layer in an mxd depending on the layer name. This worked fine as a stand alone script, but when I try to use it as a script tool with ...
2
votes
2answers
480 views

How to get path for layers listed in a combobox?

I want to get the path of a layer in my plugin, in the console it works fine but in my plugin it gives me the error AttributeError: 'NoneType' object has no attribute 'dataProvider' def run(self): ...
2
votes
1answer
658 views

How to change output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script found in this post? import_path = r"..." # Path of .mxd ...