Hot answers tagged

4

You could use NetworkX. This has the ability to create a network from a shapefile. Not tried it myself, though. PgRouting is another possibility. In the diagram below, the big red dot is the broken pipe. Pink circles are values we need to switch off. Grey circles are valves we don't need to switch off. Small black circles are where pipes join each ...


3

You can use the spatial query plugin for this (and many other) query. It will work on either all the features or just the selected ones in both source and target layers. Spatial Query is supplied in the default QGis install but may need to be enabled in your install.


3

Use QMessageBox.question: from PyQt4 import QtGui reply = QMessageBox.question(self.iface.mainWindow(), 'Continue?', 'Your message here', QMessageBox.Yes, QMessageBox.No) if reply == QtGui.QMessageBox.Yes: #do something if yes else: #do something if no or in console: from PyQt4 import QtGui reply = ...


3

qgsaddattrdialog is not available in Python (try to make from qgis.gui import QgsAddAttrDialog to see it fails) You should better inspect code from "Table Manager" plugin (done in Python). Look in particular at tableManager_gui.py file to manage the UI to add/manage fields and use QgsField For getting all QgsField from selected layers, do: ...


2

qgis2leaf is no longer being developed. See the Github repository at https://github.com/Geolicious/qgis2leaf. The last commit was on 20 April 2015. Use qgis2web instead, which is under active development - https://github.com/tomchadwin/qgis2web.


2

It is still available in the QGIS Python Plugins Repository, I can also see it in plugins list: You can download it manually from the link provided (go to the Versions tab), you should receive a .zip file. Decompress the contents of this to C:/Users/You/.qgis2/python/plugins and restart QGIS (if it is already loaded). The plugin should now be installed, ...


2

I have found a suitable solution to the question I asked earlier. To do this I used the Convert Geometry Type function from MMQGIS plugin (the plugin must be installed). MMQGIS → Modify → Convert Geometry Type From the window I chose the layer(line type) and chose New Geometry Type (this has several options) I used Centroid and selected the Output Shapefile. ...


2

Fiddling around I found out that after adding all the items, using the QgsComposition.refreshZList() function will do the trick. However, it is not possible to edit them from the "items" panel until saving and re-opening the project.


2

From what I understand, you are trying to support internationalization in a plugin you are developping. It is possible, although not very well documented. Please have a look at this answer which contains relevant information and links : http://gis.stackexchange.com/a/176200/64955. In short : the best way is to look at other plugins. You have to create a ...


2

To complete the Underdark's list I like those : Joel Lawhead, 2015. Qgis python programming cookbook. Packt Publishing, p 340. Erik Westra, 2014. Building Mapping Applications with QGIS. Packt Publishing, p 150. Anita Graser, 2014. Learning Qgis. Packt Publishing, p 150. ;)


2

This can be configured in the config file (~/.config/QGIS/QGSI2.conf on Ubuntu). I have an entry showTips=false at the beginning of the [Qgis] section (line 171 in my case). You should find a way to edit this file before launching qgis.


2

The example code above should work (coincidently with or without the 'grid.updateFeature(feature)'). The problem was in my actual code I was trying to pass Numpy datatypes and rather than throwing an TypeError, changeAttributeValue() just silently failed. Always remember to check your variable types when debugging!


2

To get information on the changed features use signal committedGeometriesChanges. This gives you the feature id and new geometry of any changed feature of the layer you connect a handler to. As an example: def feedback(layerId, changedGeometries): for k, v in changedGeometries.items(): # v contains geometry and it's further usage is up to you ...


2

MXD2QGS was built as an ArcToolbox extension; it is not a QGIS plugin. However, this tool seems that it only works with version 10.0 of ArcGis and Python 2.6. You can see other comments in: Convert .mxd to .qgs, MXD2QGS fix? https://dragons8mycat.wordpress.com/2014/04/17/mxd-to-qgis/ http://www.faqoverflow.com/gis/23717.html In Spanish: ...


1

In case anyone else has the same problem go to your plugin tab>> install and update plugins>>settings and activate view experimental plugin tab. Go back to>> Not installed plugins and search geotag and import photos plugin. You will be able to see it. In short the problem was with my settings.


1

Hi since your points are from a GPS track I am guessing that they have a Z-value field or an elevation field. When you configure the ThreeJS plugin in QGIS you should have the following options for the Z coordinate settings area: Relative to DEM Absolute value I did an example with point data and line data that have an attribute called elevation. I ...


1

The Rectangles Ovals Digitizing plugin only works for polygon layers, not for point or line layers.


1

Found a simple way to simulate traffic by animating the lines which the represented the traffic path. I am running QGIS 2.8.3 Wien. The first thing is to create and prepare the lines which represents the traffic path. Once this is completed, MMQGIS provides a functionality for animation. The option i choose here is Animate Lines. (Note MMQGIS is a plugin ...


1

This aspect of plugin development is indeed poorly documented. I have run into the same problem and already posted a few answers to related questions : QGIS - Edit UI - Python Init function localization with QTranslator Multi Language support for QGIS python plugin Hope this will help you.


1

An exemple to complete snaileaters's anwser : def print_informations(layerTreeNode, checkstate): '''print some informations when a group or a layer is checked''' if checkstate: if layerTreeNode.nodeType() == 0: print "Group " + layerTreeNode.name() else: if layerTreeNode.nodeType() == 1: print ...



Only top voted, non community-wiki answers of a minimum length are eligible