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

learn more… | top users | synonyms

0
votes
0answers
18 views

How to set “draw line inside polygon” using Python?

In the QGIS properties of a layer I want to activate "draw line only inside polygon" for a specific layer, but using Python. I don't want to use the GUI for it. Can this be done? I set the line ...
1
vote
0answers
36 views

How to generate surfaces of different heights from LIDAR points

I am seeking a way to generate surfaces (polygons in a 3D space) of different heights from LIDAR point clouds.The typical application is like roofs, which may include holes, due to different heights. ...
0
votes
0answers
14 views

PYQGIS Layer to KML?

I am aware that it is possible, in QGIS, to save your Vector Layer as a KML file manually, however, I want to know if there is anyway I can do this programmatically from an external Python Script that ...
0
votes
0answers
19 views

QGIS error: 'NoneType' object has no attribute 'isGeosEmpty'. What's wrong with this union? [on hold]

I'm trying to union two vectors. The red + grey polygon layers shown above. When I run union I get the following error: 'NoneType' object has no attribute 'isGeosEmpty'. Any help with what may be ...
4
votes
1answer
96 views

Programmatically finding polygons which are >90% overlapped by another vector polygon layer using QGIS?

I'm trying to figure out how to use python to extract the polygons in one vector that are overlapped by >90% by another vector. I would then like to have a vector/map that will only show those ...
1
vote
0answers
36 views

How to convert Shapefile to KML in Python

My goal is to extract certain shapes from a shapefile, and render the chosen shapes in a KML file. From searching gis.stackexchange, I was able to piece together the necessary components, and the ...
0
votes
0answers
22 views

Reading and writing block windows with Rasterio? [on hold]

I'm trying to go about reading large rasters by the block windows in Rasterio. Everything works and I can iterate and output the flat file for my coworkers, but I can't for the life of me figure out ...
2
votes
1answer
30 views

Exceptions for invalid files/ filenames that already exist in database

The script below is functional, but it runs into issues if it comes across duplicate files (even when overwriteOutput=True) and corrupt shapefiles when running feature to feature. Are there ...
0
votes
1answer
41 views

QGIS Processing Toolbox not valid

I have a 64 bit windows 10 computer with ArcGis 10.2.2 Installed. I just downloaded QGIS the newest version 2.14 64 bit. it downloads but the processing toolbox throws this error Couldn't load ...
0
votes
1answer
16 views

Error operating on file using grass

from grass.pygrass.modules.shortcuts import raster as r gscript.run_command('g.region', ...
1
vote
1answer
59 views

Parse and load GPX into database? [on hold]

Having a PostgreSQL database, with the following tables: CREATE EXTENSION postgis; DROP TABLE IF EXISTS trips CASCADE; DROP TABLE IF EXISTS locations CASCADE; CREATE TABLE IF NOT EXISTS trips ( ...
1
vote
2answers
41 views

Extraction of raster with shapefile python

I have a raster tiff file containing vegetation index & also a shapefile of fields. I want to extract the field wise values from that raster file using GDAL. How can I do this? I can read the ...
1
vote
0answers
29 views

Qgis python: no interaction with Map Canvas

I've created a simple python script to load and show two layers and zoom to the first one. It looks like the script doesn't run the last 4 lines after I uncomment'print lyr1'. Anyway the map canvas is ...
0
votes
0answers
49 views

Mapinfo wor file not working when file paths are updated using python

We did a data move and so I scripted the updating of the wor, so the old file path is changed to the new file path. It looks like it works perfectly but when I open the wor file it doesn't. When I ...
1
vote
0answers
23 views

Replacing path names in FME Workspace with python [on hold]

I need a Python code which replaces the place holders ('%p%') in a template FME Workspace which is imported via fme_in = open(self.filename1, 'r') and writing the path name which come from a input ...
0
votes
0answers
24 views

connecting Postgis, Python, Openlayers

I'm in the process of learning Geo-mapping and I'm curious to create a web-application Python-Django, Openlayers 3 and PostGIS. I need to know whether Django can be combined with PostGis and ...
1
vote
0answers
22 views

Per-pixel Descriptive Statistics through multiple Raster layers

I'm looking for computing different descriptive statistics through a set of raster layers. I need to make it with a python script capable of running into a standalone tool within the QGIS. To do so ...
0
votes
0answers
34 views

Transitioning MapServer from 32bit to 64bit: CGI Error

I am moving a mapserver system from 32bit to 64bit Windows (too many frustrations with multiple python installations). There is no straightforward MS4W installation for 64 bit. I am using Apache2.4 ...
0
votes
0answers
17 views

Opendap automated download with Python in ArcMap [closed]

I want to use python to automate the download of satellite images from OpenDap. I did find a similar post here, but I have tried using this script and it does not work How I can extract a subset of ...
0
votes
0answers
6 views

Tuning Geoserver datastore with gsconfig

I'm trying to create a datastore in Geoserver with gsconfig and it works, up to a point where i want to enable for instance "Expose primary keys" or "Support on the fly geometry simplification" tags ...
1
vote
1answer
24 views

gdal_polygonize returns with a strange error

i'm trying to execute gdal_polygoinize.py command. I have a main python method that takes in input a raster file and a output shapefile, and then calls a method named polygonize.py that builds and try ...
1
vote
2answers
52 views

Clustering geographical data based on point location and associated point values

Given data points with longitude, latitude, and a third property value of this point. How can I cluster points into groups (geographical sub-regions) based on the property value? I searched by google ...
0
votes
1answer
51 views

Why Does Fiona Crash Python When Creating an Output File?

I've basically followed the Fiona online manual verbatim to write an output file but my code crashes when I call Fiona.open() to create said output file. Traceback reports that the reason for the ...
0
votes
1answer
51 views

RasterStats import zonal_stats error [on hold]

I just installed rasterstats 0.10.3 Python library on my Windows machine and everything went fine with pip installation (had to install fiona, rasterio wheels separately prior to installing ...
2
votes
1answer
35 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 ...
3
votes
1answer
28 views

QGIS python getting number of new features to be stored in layers

I mean, how could I get the number of features that have been created in a given layer and that are pending to be saved in the layer when "Toggle editing" or "Saving layer edits"?
1
vote
1answer
26 views

QgsMapCanvas object is not callable (Ubuntu with, Eclipse, Python & QGIS 2.0)

I'm basically borrowing the code for picking up a coordinate from a mouse click from this answer : How to programatically check for a mouse click in QGIS However in a stand alone application I do ...
0
votes
0answers
24 views

Python condition “if” problem [closed]

I have a txt file (each column divide by TAB). In some field there are "\N" but it's like a word not a wrap. I already split and I would like write: if (a[0] == '\N' and a[1] == '\N') ... etc.. ...
3
votes
1answer
45 views

Replace non-ASCII characters in QGIS Field Calculator

I want to replace all non-standard characters from fields in a dbf table in QGIS. From http://stackoverflow.com/questions/20078816/replace-non-ascii-characters-with-a-single-space I see we can use ...
0
votes
0answers
21 views

Remove date from beginning of filename, add to the end [closed]

I have a group of files I'm trying to database (with improper naming conventions starting with dates) i.e. 20160524_Whatever_Whatever I'd like to remove the date and _ and append it to the end of the ...
0
votes
0answers
23 views

When I open the software this message showed “Import Error No module named osr” . I am using QGIS 2.6.0 version

This is the image of the error that occurred. I was able to use the software, but I'm bothered by the error.
1
vote
1answer
33 views

How can I obtain selected value from QGIS using python algorithm?

I'm writing an algorithm in python for QGIS and i have a function which uses a value from a selection. The problem is that when i select a value the script give me the error that the local variable ...
1
vote
1answer
47 views

Creating a polyline with a specified slope

I would like to create a road (polyline) starting from a point, with a specified slope, until reaching the top of a hill (or going out of the DTM Raster). The dowstream slope of the DTM must always ...
3
votes
2answers
151 views

Can this Be Recoded to Be More Efficient with Respect to Processing Time?

I'm very new to GIS but have been asked to parse through any given ESRI GDB file-folder without using any ESRI product. I've been trying to focus on using Fiona and Shapely as these seem to be ...
1
vote
1answer
36 views

How is it possible to programmatically export current view as georeferenced image with QGis?

I found the this to export the current view as image. The following code works and was accepted as answer. c = iface.activeComposers()[0].composition() image = c.printPageAsRaster(0) ...
1
vote
0answers
15 views

pyd error install qgis 2.14

I removed qgis 2.10 so i could install qgis 2.14. But when i try to install 2.14 i get errors on python .pyd packages. Every time it is a different pyd causing the error. I had this problem with ...
0
votes
0answers
53 views

SAGA GIS API ERROR (import saga_api)

I want to use saga api on my Idle with Python but I have problems. First I have Windows 10 64 bit, I install SAGA GIS via OSGeo4W64 64 bit, and I have Python 2.7.11 64 bit. I follow steps for the ...
1
vote
1answer
27 views

How do I get the feature from a single-feature OGR layer in Python without looping?

A while ago I asked why the 0 index in a OGR layer was not a feature and it turned out that OGR interprets the index as Feature ID and looks that up. Now I filtered a layer to have only one feature ...
1
vote
0answers
27 views

How to automatically run some scripts for QGIS python console by defining the python macros checkbox

I'm working with QGIS 2.8 in windows 10. I've defined the python macros checkbox to QGIS start and simultaneously run a script that has the same path from my "QGIS.qgs" file. In the Project>Project ...
2
votes
1answer
62 views

“unexpected indent” in the script

I'm using a QGIS 2.8 in windows 10. I have 2 scripts that are working separately but when I write both in just one script, it doesn't work. The 1st script is to load one raster to QGIs with a defined ...
1
vote
1answer
35 views

Question about Using r.mapcalculator in Python console

According to the following conversation: Using r.mapcalculator in Python console? I tried: ##NoData Background=name ##RASTERLAYER_BAND=raster ##nodatabackground=output raster import processing ext ...
3
votes
2answers
50 views

Distance Matrix of two datasets

I have two datasets of the same adresses, one geocoded with Google, the other with Nominatim. Now I want to compare address1 of dataset1 with address1 of dataset2, then address2 of dataset2 with ...
1
vote
0answers
48 views

How to implement a shoelace formula into Python 2.7.8 [closed]

Here's the image of the equation I'm using, it is a shoelace formula. I need help to point out what each variable represents and how to apply this in python script, math is not my strong-suit! From ...
4
votes
1answer
42 views

Read from TIF overviews using rasterio

I'm reading a window of a tif using rasterio. How do I utilize the available overviews to get a down-sampled version of the data instead of reading at the true resolution? Right now I am reading a ...
3
votes
1answer
76 views

Script that runs automatically from the QGIS Python Console when QGIS starts, using schedule tasks on Windows 10

I'm working with QGIS 2.8 and windows 10. Is it possible that after open QGIS using the schedule tasks from windows 10, I could open the python console and run a script within QGIS programmatically. ...
0
votes
0answers
25 views

How to do a Python / Fiona / Shapely equivalen to an ESRI ArcPy SpatialJoin?

I'm a GIS noob, but I am trying to learn as quickly as I can. Please bear with me. How can I identify what structures from one layer are WITHIN in some body of water in another layer? My problem ...
4
votes
0answers
28 views

Using QgsNewVectorLayerDialog

I am using QgsNewVectorLayerDialog for taking user input for creating a new shape file. When the user clicks OK i am reading the inputs selected by the user using the following code. dlg = ...
2
votes
0answers
48 views

Image stacking with Python/Gdal

I am trying to accomplish some image stacking task in python. I am not proficient in Python and was hoping I can get some guidance to get started. So I have large number of landsat images. Landsat ...
6
votes
2answers
59 views

How to use current layer name in FME PythonCaller?

In a PythonCaller (FME 2014 SP4 in Data Interop in ArcGIS 10.3), I'd like to do some conditional processing based on the layer that I'm currently processing. I'm feeding in a text file of layers ...
1
vote
1answer
34 views

QGIS - Get Bounding Box of Map Extent in Stand Alone Application

I basically have the same question as this one : How to quickly calculate bounding box coordinates of a selected polygon with qgis However I am building a stand alone application in python and so ...