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

learn more… | top users | synonyms

2
votes
2answers
21 views

How to create Raster statistics with GDAL externally?

If I want to create a GDAL PAM statistics file with the command gdalinfo -stats from a GRIB file, e.g. needed for DynamicColorMapping, GDAL only creates the statistics internally inside the sourcefile....
1
vote
0answers
18 views

ImportError: Cannot import name globalvar

For those familiar with QGIS with Grass I need help... I installed QGIS 2.16.1 with Grass 7.0.4 on both a Windows 10 desktop and a Windows 10 laptop. On the laptop version I use Grass to create a ...
0
votes
2answers
18 views

How does gdal_translate need to be edited when scripted?

Apologies, I'm relatively new to python scripting and I'm trying to batch process a number of files, with the first command being to convert formats. gdal_translate -of KEA NDVI_20160101.tif ...
1
vote
1answer
35 views

Changing/adding information about QGIS plugin without causing errors?

I developed my first plugin to Qgis and I wanna upload it, but... to do this I have to change information about plugin (like description/add code repo link and bug tracker link) and that's where my ...
0
votes
1answer
29 views

How to assign numerical value to polygons?

I have a shapefile of polygons, and a list of mean values of the area in each polygon. I need to assign said mean values to each polygon. How would I go about this using GDAL/OGR in Python?
0
votes
0answers
4 views

Scripting Feature Selection in Whitebox GAT

In Whitebox GAT, a vector feature selection operation is achieved using the Feature Selection tool, which triggers the Feature Selection dialog. In this dialog, the user can enter a line of Groovy ...
0
votes
1answer
17 views

PostGIS to Find Dupes and Segregate Geometric Dupes from Originals?

I've written some code in Python and PostGIS to find duplicate geometric features within the same feature layer. That part is a success. The problem I have is the dupes as well as the original ...
2
votes
4answers
59 views

how can I get the vertex list from a shapefile line using python or R? [on hold]

I need to extract the vertex list from a line inside a shapefile. I want to know which would be a better option between python and R.
0
votes
1answer
13 views

OSM to OGR - Stream or File - install missing driver

I'm trying to convert a .osm-file or overpass stream (both XML-based) into OGR conform layers. I already found an approach which should work: https://pcjericks.github.io/py-gdalogr-cookbook/...
0
votes
1answer
12 views

Call external plugin from python

I have written a python script for Qgis 2.14.3 which reads in every .txt file in a folder containing hundreds of .txt files (format: "X Y Z" whitespace-separated)and converts them to ESRI shape files. ...
1
vote
1answer
78 views

Using GDAL's Python Bindings, how can I download an entire Layer?

I'm trying to write a Script, which will download an entire WFS layer to Disk. The output format could be GeoJSON, Spatilite or even Shapefile. I know how to do this using ogr2ogr, but I need to use ...
3
votes
1answer
43 views

calculating coordinates from a gnomonic projection

I have a collection of images from a rain radar which show intensity. I have loaded the images and create a matrix of pixel colours. What I need to do next is generate a set of coordinates for each ...
0
votes
0answers
37 views

Error installing plugins that require matplotlib in QGIS 2:14?

I'm trying to run some plugins in QGIS 2.14 Essen among them the Semi -Automatic Classification Plugin but I'm finding the following when trying to run: This supplement is broken matplotlib ...
0
votes
0answers
23 views

How to automatically download eMODIS NDVI data using Python

How would I approcach setting up an automatic download of the MODIS 250 m daily NDVI products for the USA using Python?
0
votes
0answers
6 views

GRIB2 to TIF conversion yields incorrect pixel values

I am working with grib2 data and here is my task : Take in the 24 hour sum of the total precipitation and display it in .tif When I open up the data in panopoly, it shows me the values I am ...
2
votes
0answers
26 views

Boolean field (attribute type) in PostGIS with OGR Python

In my project I'm using ogr (python bindings) for inserting spatial data in PostGIS. The spatial data comes in all different formats (CSV, Shapefile, GeoJSON) etc and before creating new tables in ...
0
votes
0answers
17 views

Qgis shows AttributeError: 'Nonetype' object has no attribute 'getFeatures'

I'm currently writing a python script for qgis where I have a set of point locations and I want to calculate the area a set of various land uses within a specified buffer around each of the specified ...
0
votes
1answer
16 views

Can I have ogr ExportToJson export with NO z coordinate?

I have code exporting a polygon to a json file, I would like to do this without the z coordinate since I don't need it and editing the database that was created from geodjango migrates looks painful. ...
0
votes
1answer
32 views

Is there a non-ArcPy way of joining a table to an existing raster attribute table using Python?

I have an existing raster with attribute table and would like to join a csv to it. Is there an open source way of doing so using Python libraries like rasterio, pygeoprocessing, etc.?
0
votes
0answers
46 views

How to get data from one shape file into other.

I have two shapefiles both in EPSG: 3857. 1) One represents the cover of different types of vegetation. (vegetation vector). This file has 170,000+ features. and Has an veg-type column. 2) The ...
0
votes
1answer
19 views

Add Temp Attribute to Readonly WFS map

I have been working on a QGIS plugin. I have run into some problems and to solve it, one of the solutions would be to add a column to the WFS layer. However most of the times, I have not the ...
1
vote
0answers
43 views

How to make a Python Multiprocessing Script work on Windows OS [closed]

I use the Python multiprocessing module to speed up a function (get_craters_for_buffering_BCC) in my script. In this function, I want to identify points (passed as a list: crater_features_list) within ...
0
votes
0answers
18 views

WFS-T request works in localserver but fails in remote server

I have a local server with a geoserver 2.7. I use python requests in order to add geometry in a postgis store. It works great. This is how it looks like: headers = {'Content-Type': 'application/xml'} ...
1
vote
0answers
28 views

Trying to convert lines to points

I'm using QGIS and MMQGIS and I get this error: Traceback (most recent call last): File "C:/Users/Ana Eljall/.qgis2/python/plugins\mmqgis\mmqgis_dialogs.py", line 956, in run ...
0
votes
0answers
21 views

Importing a raster from Postgis using Python 2.7

So here is my current issue. I have used Python to create a simple fonction that'll apply a lot of SAGA's modules to a selection of DEM raster datas. I tested it, it works flawlessly on my sample data ...
0
votes
0answers
31 views

Creating slope layer from DEM using python gdaldem?

I have this elevation map with CRS [EPSG:4258]. First I created the elevation raster. Then I tried creating the slope layer using gdal and command line with the following command " gdaldem slope ...
2
votes
1answer
16 views

Cut a picture with the grip of another image

I have two raster images. Let "A" and "B" my images with "A" larger than "B" I would like to cut A for it to have the same grip as B with the python script for use in the automation of a processing ...
0
votes
0answers
3 views

How can one easily differentiate KML placemarks of polygon and icon type?

I'm using fastkml in python to parse a large kml file where Google Earth has made a new style for every placemark. I'm trying to parse subfolders which contain a point placemark and/or a polygon ...
4
votes
2answers
83 views

How to generate random coordinates in a multipolygon in python

How to generate random points in multi-polygon using geojson in python ? thus far I found a class in JavaScript named : randomPointsOnPolygon(numberOfPoints, polygon) but I need to use something ...
0
votes
0answers
31 views

Using Python to simplify extraneous KML Styles in large KML document?

I have a large (~4Mb) KML file which comprises my Consolidated Earth Impact Database (CEID), a database of impact craters on Earth. The KML folder format (simplified): CEID Australia ...
0
votes
0answers
10 views

1.#QNAN000 with shapefile.Reader

I'm creating a shapefile via a Python script using shapefile.py. Everything looks fine in QGIS, hence when I try to access the records via shapefile.Reader(object).records() I got following error: ...
0
votes
1answer
28 views

How to do an Overall Minimum Bounding Rectangle from a Python List of MBRs?

I've converted an ESRI GDB file over to a PostgreSQL DB and went through all the layers now expressed as tables. I originally looked here but realized that having ~ 49 tables / layers would get hairy:...
1
vote
0answers
26 views

gdal.rasterizeLayer in QgisPython results in Nan values

I have a vector layer projected in WGS84. I would like to use gdal.rasterizeLayer() from the python console to convert it to a raster. I would like to burn values from a field. I followed the gdal ...
2
votes
1answer
35 views

Fast Polygonal Distance Approximation?

I have a large number of polygons, and I'd like to calculate an approximation of the distance from each one to each other one. However, calculating the distance between two polygons is slow. ...
1
vote
0answers
21 views

ogr2ogr .osm.pbf speed up clip [closed]

At the moment I am clipping osm.pbf files. From the osm file, I only want to extract the buildings. The outcome should be shapefile with all the buildings within a nuts2 area. The following code ...
1
vote
1answer
35 views

How to get WKT from a QgsGeometry object?

How can I get the wkt from a geometry object in python? I'd like to be able to do something like the following: from qgis.core import * import qgis.utils layer = qgis.utils.iface.activeLayer() for ...
0
votes
0answers
21 views

Saving Changes in representation , ArcObjects + python

I have managed to print the representation and remove it according to their ID , if the rule print after, I get the error that the rule no longer exists, this means that if you do, but I not get some ...
1
vote
1answer
30 views

How to refresh QGIS Relation Reference widget without closing and reopening form?

The Relation Reference widget has buttons to open a 2nd form so that records in the referenced (parent) layer can be edited or new records added. However, when the edits are made to the parent layer ...
3
votes
1answer
29 views

Get the crs of a raster file in a standalone script - Qgis Python

In a standalone Qgis python script I would like to get the CRS of a raster file. The idea is that I ultimately want to reproject it (probably using processing.runalg("gdalwarp ... ) but I don't want ...
0
votes
0answers
22 views

No JSON object could be decoded, JvectorMap Converter

Scenario is, Im new to python and trying to generate jvectorMap using Converter.py plugin provided by jVectorMap, I have installed OSGEO4W (Desktop INSTALL) on Windows 7 64bit. Python 2.7,GDAL 2.1.0 ...
0
votes
1answer
44 views

In python gdal how to add Ground Control point to GeoTiff image by using gdal_translate

I have a GeoTiff image consisting of 400 Ground control points. I have now extracted all of these points into one string so that I can implement it into gdal_translate. print gcp_string -gcp 0.0 0.0 ...
0
votes
0answers
18 views

How to use gdal_translate to transfer all 400 gcp's at once

With gdal_translate we can add GCP from one source to another source gdal_translate -gcp pixel1 line1 X1 Y1 -gcp pixel2 line2 X2 Y2 ... source.tif sourceGCP.tif gdalwarp -r bilinear -t_srs EPSG:xyz ...
2
votes
1answer
28 views

How to save json returned by gdalinfo in python variable

When I run the command in osgeo4W shell gdalinfo -json C:\Users\Gurminder\Documents\Git\Dump\s1a-ew-grd-hh-20160725t043517-20160725t043617-012300-01322b-001.tiff I get a large json of my Ground ...
2
votes
1answer
48 views

How to loop over rasters in a list with QGIS script?

Using QGIS 2.14, I want to loop over rasters in a list with a QGIS script. ##Input_raster1=raster ##Input_raster=raster ##resul_rasters= output raster list=[] list.append(Input_raster1) list.append(...
1
vote
1answer
27 views

QGIS Midvatten database error (python error while executing python code)

I am trying to create a Midvatten database and i keep getting error message that says "error has occured while executing python code (python error)". Below is the error message: 2016-08-09T18:28:49 1 ...
1
vote
2answers
75 views

How to keep the same name in the entry of the script (QGIS 2.14) output file?

For example, I have a raster called "raster_img.tiff". I use it as input in QGIS script and want it to be in output file called the same name like input + new. ##Input_raster1=raster ##Band_raster1=...
3
votes
1answer
70 views

How to save the QGIS SCRIPT result in a folder [closed]

I would like to save my result from QGIS Script in a folder but I don't know how. ##Input_raster=raster ##result_out=output raster outputs_SAGARASTERCALCULATOR_1=processing.runalg('saga:...
1
vote
1answer
30 views

Loop over GeoTIFF image pixels, extract coordinates and pixel color

I have a very large GeoTIFF image (~650MB) with color-coded landcover data from here. I need to extract the latitude, longitude, and pixel color for each pixel in the image, so I can import it into a ...
2
votes
1answer
31 views

Dynamic label generated by python in composer template?

I just recently started to play with python and items in print composer. Given item ID it is possible to do many great things with the item through code, one of them is changing text of text label. ...
2
votes
1answer
26 views

How can I convert Bing's “quadtree” tile addresses to ZXY tile addresses in Python?

Bing uses a quadtree-based addressing scheme to come up with a single number (or all-digit string) as the address of a tile. Each digit/character (starting from left / most significant) identifies the ...