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

learn more… | top users | synonyms

4
votes
1answer
53 views

How do I update joined data from MySQL programmatically?

I have a point vector layer (Sensores) in my QGIS project, I also have a MySQL database layer (SensoresDB) containing only data. I have joined these two layers in order to geographically reference my ...
1
vote
1answer
26 views

How to simplify borders between polygons in shapely?

I have some fairly complex, and not completely accurate shapes stored as shapely Polygon objects. I'm trying to find the common borders, which should be as easy as finding the LineString returned from ...
1
vote
1answer
14 views

QgsComposerTextTableV2 minimal implementation?

I would like to use the richer data and styling API QgsComposerTextTableV2 offers. However I get this error when adding it to the composer: TypeError: QGraphicsScene.addItem(QGraphicsItem): argument ...
2
votes
1answer
29 views

Using zonal_stats with python in QGIS to calculate statistics for each image

I work with Python in QGIS, I want to calculate statistics for each image that I have with a specify shapefile and save result after, I tried to do like this: from rasterstats import zonal_stats ...
2
votes
0answers
48 views

Use QGIS API on standalone python program without install the entire application

I developed a standalone python program that makes use of QGIS API to create .qml files from sld files. This is a small program of about 15 lines of code that imports the following modules and uses ...
1
vote
1answer
65 views

Create Table with postGIS geometry in Python

I'm creating the following table with a postGIS geometry column in python but get an error psycopg2.ProgrammingError: type "geometry" does not exist What should I use to be able to use postGIS in ...
0
votes
2answers
34 views

How to Call ArcHydro Tools in Stand Alone Python Script

I am currently using ArcGIS ArcHydro tools to perform 'Catchment Polygon Processing'. However, it is proving time consuming to perform this for multiple rasters. How might a write a python script to ...
3
votes
1answer
37 views

How to insert a variable into a tool script

I am a bit new when it comes to Python programming and this is very basic but I can't come up with a solution. I'm trying to run the GRASS r.sun plugin tool to calculate the global irradiance for my ...
5
votes
1answer
100 views

Export .qml file using QGIS API

Im loading a shapefile using the method QgsVectorLayer() and adding a style to it using the method loadSldStyle() and the path to the sld file. So far so good. What I want now is to export that style ...
1
vote
0answers
45 views

QGIS: startup.py missing [closed]

I am trying to set QGIS 2.8.1 (Linux Mint 17.2) to add the filename/path to layouts. I am using this post as a guide How to add the current document path on Print Composer? However, I haven't got ...
1
vote
0answers
54 views

mosaic rasters with gdal_merge.py

I want to mosaic 2 rasters "rasa" and "rasb" using gdal_merge.py . While running the code, it produces an error " No input files selected". Can somebody help me to find the error in the code? ...
1
vote
0answers
30 views

Programmatically adding folders & layers to QgsComposerLegend

I've been building up QgsLayerTree object with a directory structure that reflects the desired legend. Specifically I'd like the Group(s) to be titles and their contained layers to legend items. ...
0
votes
0answers
19 views

Convert geoalchemy2 Geometry(polygon) column to OGR Geometry

I would like to use OGR to perform analysis. My data currently lives in a PostGIS database. I am loading my data into a python environment using geoalchemy2. I am hoping that a line similar to the ...
1
vote
1answer
41 views

Connect / Disconnect GPS device via PyQGIS

In QGIS I would like to establish a connection to my GPS device programmatically (not via button in the GPS control panel) I found out how to get available ports with QgsGPSDetector i.e. ...
1
vote
1answer
45 views

Qgis -> Settings -> Customization : how to import ini file with python?

With QGIs, from "Settings"->"Customization" i can hide/show the components of the GUI. I can export a INI file with my customization. There is a way to import my INI file with a python command in ...
2
votes
1answer
58 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 ...
0
votes
1answer
28 views

How can I write private tag GDAL_NODATA to a TIFF using libtiff?

In an earlier post I asked how to retrieve this tag from TIFF using python and libtiff. Eventually I found the answer and I reported on the solution last week. I also realised that in order to write a ...
0
votes
1answer
39 views

Python: Running a function on all points in a list [closed]

I'm trying to get a list of cartesian points along contour lines and convert them to polar coordinates. I'm trying to run a function to convert them to polar, one for the length and one for the angle. ...
2
votes
1answer
30 views

Raster brightness, contrast, saturation in PyQGIS

I'm trying to find a way to change these properties (especially contrast and brightnes) and I've found a QgsBrightnessContrastFilter class, but I can't fugure out how to apply it to my raster layer. ...
1
vote
0answers
41 views

How do I calculate the percentage of progress using raster data using Python?

How do I calculate the progress amount of two or more raster data being processed? I have seen examples of vector data but it becomes difficult to calculate the progress when no vector data are ...
0
votes
0answers
34 views

cartopy: plotting shapefiles

I am new to gis and am trying to plot a shapefile containing land polygons. (From OSM.) Unfortunately my output image is always empty (i.e. white). Can somebody tell me what I am doing wrong? import ...
0
votes
1answer
34 views

Shebang line for ArcGIS Desktop [closed]

I'm writing a script to be run on ArcGIS for Desktop, which only runs on Windows machines. Is there any use for a shebang line at its beginning, and if there is then what should it be (e.g. ...
0
votes
0answers
38 views

Getting closest point on road to point in OpenStreetMap using Python?

I need to find the closest point on a road to a external point in OSM, but I need to do it without downloading the OSM data nor using PostgreSQL, i.e., I can't use the solution pointed in How do I get ...
2
votes
1answer
53 views

How can I get a map image from an ArcGIS mapserver centered on a single feature?

I have a Python program that is not using arcpy. I need to get an image from a mapservice centered on a single feature using the REST api. I can call the export method to get a map image: ...
3
votes
1answer
48 views

Error when using r.series in a python script

I’m writing a tool script in python and at a certain point I want to use the GRASS tool r.series. I want the algorithem to read all raster files from a folder and calculate the maximum with r.series. ...
-1
votes
0answers
25 views

converting to geojson

I have a json as below "data":{"1":{"cartodb_id":1047299,"jsongeom":"{\"type\":\"MultiPolygon\",\"coordinates\": [[[[-114.159837221251,51.1732306066514], ...
0
votes
1answer
23 views

Install pygeoprocessing on ubuntu 14.04 and python3

I'm trying to install the pygeoprocessing package for Python 3.4 on an Ubuntu 14.04 VM. I have all the necessary versions of the required dependencies (GDAL, numpy, scipy, shapely, Cython). ...
2
votes
2answers
95 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 ...
1
vote
0answers
7 views

Inconsistent indent QGIS [migrated]

I try to set some qwidgets on fields in a Qgis Project, but i have an error of inconsistent dedent at elif field.name() == 'syst':. Made so far: def load(self): map_layers = ...
0
votes
1answer
33 views

Hide/Show leaflet markers based on specific values

So I have a Python list of dictionaries with a number of IPs and "Scores" for each IP. I'm adding them to my front end map / leaflet using jinja2 like so: var map = L.map('map') ...
2
votes
1answer
93 views

How to find the intersection areas of overlapping buffer zones in single shapefile?

Find the intersections of the buffer zones I found an example where they tried finding the intersection of two different shapefiles -Intersect Shapefiles using Shapely. I've tried to adapt my code to ...
1
vote
1answer
36 views

How to install 3rd party python libraries for QGIS without OSGeo4W on Windows?

I want to install pip package in QGIS. I have tried the standard windows installation from Windows command line as explanined in pip site, but still can not import pip from QGIS Python console. I have ...
3
votes
1answer
67 views

Show QGIS feature count via console on existing layers

I want to make a script that toggles feature count on for all vector layers. I followed the following article: Show feature count of layer via Python console / PyQGIS. Instead of adding new layers ...
0
votes
2answers
58 views

AttributeError: 'NoneType' object has no attribute 'length'

I try to open the attribute table of a layer witch has a PythonInit fonction with a Ui form and returns "AttributeError: 'NoneType' object has no attribute 'length'". Made so far: from PyQt4.QtCore ...
7
votes
3answers
1k views

Is there a way to “invert” Polygons?

I have a Shapefile with Polygon features representing the world's land areas (continents, islands). Is it possible to invert these, and get a geometry that represents the world's oceans and seas? So ...
1
vote
0answers
16 views

pyqgis change or update attribute data with real-time data or Timer update,Memory has been growing

I update my shapefile attribute data by QTimer ,and labling it, keep the lable visiable,change attribute by 1 minute, but the Memory has been growing 1 layers ...
2
votes
2answers
36 views

Dynamically adding in-memory QgsVectorLayer triggers a popup in the UI - how to eliminate

I use this function to create layers that display results to my queries. However a dialog always pops up asking me to confirm the crs. Is it possible to suppress this ? def addResultLayer(name, ...
2
votes
1answer
77 views

Delete all fields with the string “RAWI” using QGIS Python

I would like to delete all fields with the string "RAWI". For instance the field "RAWI_WA" and the field "RAWI_BO" should be deleted but not the field "NSG_RAW"
2
votes
1answer
21 views

Store geometry Qgis feature creation

I make a form that has a textEdit wich stores the length of a line. How it is possible to store the length of the new created line and put it in the textEdit, when form appears?
0
votes
1answer
28 views

How to extract a shapefile with a SQL expression from a database of shapefiles using PyQGIS or OGR [duplicate]

I have a shapefile Water_Districts.shp that consists of several water district polygons. I am trying to use the script below to 'extract' a specific polygon with the name Cache La Poudre River listed ...
1
vote
1answer
71 views

ImportError installing GDAL on Ubuntu 14.04 with Anaconda Python 3.5

I installed the GDAL library on Ubuntu 14.04 through the Anaconda (Python 3.5) distribution. After installation, which seems to work fine, I try importing it and I get this error: >>>from ...
4
votes
2answers
76 views

Model Builder/Python: batch raster calculation

I wish to carry out a raster calculation on a batch of rasters. I want to add rasters by month, as identified by their file name. i.e. all rasters within the month of January should add together and ...
0
votes
0answers
29 views

Is there an automated way of downloading the natural color .TIF images for Landsat 8?

I know that .jpg natural color images can be downloaded from AWS. But, .jpg doesn't contain the world metadata along with it.
-1
votes
0answers
73 views

How Draw a line between two point?

There's a long time I search for a solution to this problem and I have not found. The reason why I post it as a question in this forum. I have a CSV file containing the coordinates of each point ...
5
votes
2answers
93 views

QGIS python processing.runalg Clip returns None

I'm writing a script in pyQGIS, which would emulate measurement of a line by "walking" along it with a compass with constant length. I have a problem with the Clip algorythm from processing module, ...
2
votes
1answer
67 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 ...
1
vote
1answer
14 views

Error using gdalwarp in EPSG:4326

I tried to change the projection of AMSR-2 in Python using: 'gdalwarp -geoloc -t_srs EPSG:4326 C:\GW1AM2_201301311114_050A_L1SGBTBR_1110110.vrt C:\test100.tif' It said there are something wrong ...
2
votes
1answer
42 views

Creating custom forms in Arcmap 10.3

I am hoping to make a custom form within ArcMap 10.3 where the end user can select a recently digitized shape file (or feature), and enter values of specific attributes through a custom form. This ...
1
vote
2answers
69 views

problem combining geometries from all features in a layer as one geometry

I am trying to combine all features of a Polygon layer in QGIS in a python plugin, and am running into this error when I try to run the combine method: "AttributeError: 'NoneType' object has no ...
1
vote
1answer
40 views

PyInstaller myscript.py - issues: empty dist folder

This question is subsequent to another question: here. The question was solved but I ran into another issue and tried to ask it there but it is worth being its own question I think. Python version in ...