Tag Info

New answers tagged

1

This is not exactly the answer to your question, but rather a suggestion. For RS, I would not use QGIS as a core software, because it is more oriented for GIS (even if it includes many tools). I suggest that you have a look at GRASS 7 (the new GUI is a true step forward). I don't have a look of experience because it is new, but I got some feedback and I've ...


2

In an email exchange with Radim Blazek in the grass-user mailing list he explained: QGis from OSGeo4Win is compiled with GRASS 6, you cannot get it working with GRASS 7. Reinstalling will not help. The provider and the plugin has first to be fixed to support build with both GRASS 6 and GRASS 7. This is in the first package of proposed upgrade: ...


2

Keep things simple, you don't need a special function selectedfeatures here, you can do everything at once (try your script in the Python console before). 1) you don't need the Valtestand state_and_cities variables: layer = iface.activeLayer() idx = layer.fieldNameIndex('name') idx1 = feature.fieldNameIndex('state') for feature in layer.selectedFeatures(): ...


0

I guess you need to connect the SIGNAL selectionChanged when your plugin is opened and disconnect it when your plugin is closed. For example, you could set the connection at the beggining of the run method and disconnect it at the end of the run method. This way, when your plugin is not running, you won't get QGIS showing the information box you mentioned.


3

If I got you right, you can use the SIGNAL selectionChanged from your vector layer and connect it to your other function (which must accept an argument to receive selected features' ids). For example, load a vector layer to QGIS, activate it in the ToC and run the following code in the QGIS Python console. You should see the function is running after a new ...


0

What worked for me on the end was to use original resources that came when I created package with plugin builder and use it in all other dialogs of my plugin. I still don't know why main icon of my plugin changes when reloading plugin, but still I get graphics in other dialogs. I wish this would be different for many reasons. For building simple plugin ...


2

If you have installed a 64-bit version of QGIS on Windows and you find that Personal GeoDatabases (*.mdb) no longer work for you, then this solution might apply; I'm on QGIS 2.8.1 rather than 2.6, but I assume that the issue and thus the solution is the same. The underlying issue relates to this GDAL bug: Problem reading MDBs (64-bit) Step 1 Download the ...


5

What you need is the QGIS plugin Load Them All. Apart from loading files from several directories at once, you can: Reflect the directory structure in the QGIS Table of Contents (by means of nested layer groups). Apply alphanumeric filters so that you just load layers that match your filter (think of regular expressions). Load only certain geometry or ...


0

You may need to have this at the top of your code: from PyQt4.QtCore import * Or it might be the path you are giving it: http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/vector.html that documentation just has a file name, you could give it a path instead and then it works.


0

I solved it on my own but maybe handy for others. First i clipped the layers using Raster-extraction-clipper tool and than copied the .txt file into the folder of the clipped images. This did not work. I now clipped them using the clip multiple raster option within the semi automatic classification plug in and then copied the .txt file from the original ...


1

Note that GRASS GIS 7 comes with an updated vector format (esp. new spatial index). In order to use older vector data (from GRASS GIS 6) in GRASS GIS 7 the user has to rebuild the topology. Additionally it is recommended to switch the database backend from DBF files to SQLite. Both can be done in an automated way per MAPSET as described in this wiki page: ...


1

On QGis 2.8 this problem is caused by a known, but yet unreported bug (access to the QGis bug tracker seems restricted). Before it is fixed it is not possible to create new mapsets in QGis. However, the user can create a new mapset directly with GRASS and then open it with the GRASS plug-in in QGis.


2

You can set the base directory of the "Add Vector Layer" dialog, reflecting the latest active layer's path, this way: import os from PyQt4.QtCore import QSettings def setOpenDir( layer ): # Check if layer exists, has a proper path, and is of type vector if layer and os.path.exists( layer.source() ) and layer.type() == 0: layerPath = ...


2

Connect to the project read signal to know when a project is loaded def project_loaded(dom): print QgsProject.instance().readPath("./") QgsProject.intance().readProject.connect(project_loaded)


0

Make sure you're using the plugin version that is compatible with your QGIS version. You can intall the latest plugin version via the toolbar: Plugins > Manage and Install Plugins. Note that using the latest version of a plugin may no longer work with older versions of QGIS. There is a good answer here by @Thomas which allows you to save different plugin ...


1

One way to achive this is store the user activity in a variable like self.user_action then in your accept() method (which is called when you click Run button), use it to determine what to do def accept(): if self.user_action == 'DROPDOWN_SELECTION': self.run_function1() elif self.user_action == 'MAP_SELECTION': self.run_function2()


0

This code works well. I used it with a point shapefile (Multi Part) for getting its convexHull Polygon. layer = iface.activeLayer() feat = layer.selectedFeatures()[0] #get geometry geom = feat.geometry() convexhull = geom.convexHull() #Extract CRS from layer CRS = layer.crs().postgisSrid() URI = ...


1

I believe you want this line: nearCity = feature.attributes()[idx] to be: nearCity = f.attributes()[idx] Using the feature variable will always point to the last value in selection. (This is untested advice, so I might not be understanding something fundamental here.)


0

I have changed the windows user account control setting to the lowest level and it solves the problem on my Win7 machine. Thanks for leading me in that direction @NeilBenny Unfortunately the same trick did not resolve the problem on my Win8 machine.


1

Do you need the memory layer at all? Have a look at the "directly from features" example in the PyQGIS cookbook to see how to create a persistent Shapefile from features, so that you avoid creating a memory layer.


1

Based on the answer by Adam Bioletti, further tests to the process described show that the only essential requirement is to start editing the memory layer before making any changes, such as creating attributes and features, and then commit the changes. This can be done before adding the layer to map registry. Here's an update of the Cookbook's code that ...


1

You can overwrite the close function of your UI as well, that the plugin is reloaded every time you close it. def closeEvent(self, event): qgis.utils.reloadPlugin('YourPluginName') This will reload the plugin completely and will empty all your boxes. In this way you don't have to care about clearing the boxes because the plugin will always load only ...


1

Both underdark‚ô¶'s and gcarrillo's replies provide valid answers. How exactly the issue should be handled however depends on the use case, and if necessary, options should be provided.


1

the Line, feature = layer.selectedFeatures() returns a list of QgsFeature. You will need to loop over it to process individual selections, like below. layer = qgis.utils.iface.activeLayer() for feature in layer.selectedFeatures(): mbuf = feature.geometry().buffer(50, 2) iterFeat = layer.getFeatures() for f in iterFeat: geom2 = ...


2

You are probably setting a connection between a SIGNAL (button clicked) and a SLOT (your method showTable) every time your plugin is open (run() method?) and you are not disconnecting such SIGNAL/SLOT when your plugin is closed. This leads to a new call to showTable() every time you open your plugin, because there's a new connection calling it. A couple of ...


1

In my opinion you should empty the combo box before populating it. The rationale behind that is that the layer might have changed so it's not a good idea to set a flag and ignore everything that might happen afterwards.


0

I think the repository you are looking for is https://github.com/olivierdalang/CadInput. Plugins-Manage and install plugins and you can give the repository there in order to install and use this plugin.


1

The Measure area tool does not create a layer which can be input for Processing. You need to create a new polygon layer, for example a Memory layer, see http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/vector.html#memory-provider and Using in-memory vector layer with QGIS processing / SEXTANTE



Top 50 recent answers are included