Linked Questions

17
votes
3answers
4k views

Import error for qgis.core when running OSGeo4w shell script

I've been trying, along with this post, to run a script in OSGeo4w Shell, outside of QGIS. But I get the following error: ImportError: No module named qgis.core I have also read the following ...
7
votes
1answer
4k views

Select by location in Python

I have a polygon layer and a point layer (with coordinates for each point). The polygon layer got created using the MMQGIS plugin (Hexagonal Polygons). I want to select all the points inside each ...
2
votes
1answer
5k views

How to open a shapefile using Python in QGIS?

I have tried to open my shape files with the help of a tutorial (http://spatialgalaxy.net/2012/01/27/qgis-running-scripts-in-the-python-console/) but unfortunately I couldn't open my shapefiles for my ...
3
votes
1answer
5k views

Running Python outside of QGIS - (ImportError: No module named qgis.core)

I'm trying to run simple scripts on QGIS from outside the QGIS environment - as here How to run a simple python script for QGIS from outside (e.g. Sublime Text)? My code: import sys sys.path.append(...
6
votes
2answers
721 views

Export a configured Atlas with a Python script / command line?

I just want to export a configured Atlas (composer with Atlas option and cover layer enabled) I tried this : composerView = qgis.utils.iface.activeComposers()[0] composition = composerView....
8
votes
1answer
599 views

Calling PyQGIS functions from external editors (Linux)

Is it possible to integrate external Python editors (such as KDevelop) with QGIS, so that it would be possible to run functions in qgis.core, qgis.utils etc. outside of the QGIS Python Console? ...
1
vote
1answer
374 views

How can I always run an algorithm with standard input shapefiles from mapcanvas in QGIS 2.0.1?

I created a model in the graphical modeler and I want to run that model always with two specific polygon shapefiles from my project, e.g. pst and astenot. Whenever I run my model, it asks me to set ...
3
votes
1answer
258 views

How to export Atlas as images from a headless server?

I have a QGIS project that has an Atlas print composer that I can use to generate multiple images (JPG) of each of my departments. Now I would want to generate all those images but directly from a ...
1
vote
1answer
315 views

Enable layer plugins when using external standalone QGIS python scripts

I created a QGIS standalone script (custom Application) that enables me to automatically export Atlas as images. The problem is that in my QGIS project, I'm using a Mask plugin and the generated ...
2
votes
2answers
223 views

Why general.runalg(“qgis:linestopolygons”…) work only over first feature?

I have a standalone script that call general.runalg(qgis:linestopolygons...) all ok, but only convert the first feature, and I do previous "selectAll", why ? Full code: #!/usr/bin/env python ...
2
votes
0answers
280 views

How to trigger qgis command from outside of qgis

Imagine you have a simple (maybe shared) EXCEL sheet lising your coordinates. For each coordinate you want to check a feature in a layer or arial imagery. To make it efficient, it would be perfect to "...
1
vote
1answer
142 views

Turning a single MultiPolygon into many small polygons?

I have a large GeoJSON file with a single very complex MultiPolygon, and I would like to turn it into an identical file with many small polygons. How can I do this? I can use ogr2ogr or mapshaper or ...