[Qgis-developer] identify tool for plugins
Hi all, I have just pushed a new plugin to edit geometry as plain WKT text [0]. Basically, it works as the identify tool: if a feature is found, a dialog shows up with the WKT, which is editable if the layer is editable. I have one main concern regarding the behaviour of my plugin. I use QgsMapToolEmitPoint. The feature is found using the current active layer in the canvas and by a select using a rectangle. Therefore, the user has to choose the right layer before identifying and moreover, an invisible feature on the map can be identified. I just wonder if it would be possible to use the same procedure as identify does in a plugin and doing another action than opening the attribute editor. Maybe something like canvas.setMapTool(QgsIdentifyTool, MyAction) I thing this could be very useful for many plugin devs. If I missed something and it already exists, please let me know... Thanks a lot Denis [0] Demo at http://www.youtube.com/watch?v=9-ygwMw72Wwhd=1 ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] v.delaunay not working on sextante?
It produces areas, but fails in producing lines (I get an empty layer). Anyone confirms? Ticket? All the best. -- Paolo Cavallini - Faunalia www.faunalia.eu Full contact details at www.faunalia.eu/pc Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] select a loaded raster layer from qgis legend into python plugin
Hi, I would like to write a small python plugin to analyse some raster data, but I haven't managed to select a loaded layer yet. I searched the howtos and found several simple examples about: # get the currently active layer layer = self.iface.mapCanvas().currentLayer() but as I said I would like to select one of the loaded raster layers from the qgis legend using a QtGui.QComboBox in the plugin dialog. At the moment I tried the getRasterLayersNames() function I found in several other plugins but it seems I am missing something, because the raster layers are not selectable. Can someone point me to a simple example to understand the general procedure? Thanks a lot Otto ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] select a loaded raster layer from qgis legend into python plugin
Hi Otto, here a small extract from a plugin I wrote: Just check for the layer type to only list raster layers def initLayerCombobox(self,combobox, default): reg = QgsMapLayerRegistry.instance() for ( key, layer ) in reg.mapLayers().iteritems(): combobox.addItem( layer.name(), key ) idx = combobox.findData( default ) if idx != -1: combobox.setCurrentIndex( idx ) Regards On Thu, 2013-01-17 at 15:54 +0100, Otto Dassau wrote: Hi, I would like to write a small python plugin to analyse some raster data, but I haven't managed to select a loaded layer yet. I searched the howtos and found several simple examples about: # get the currently active layer layer = self.iface.mapCanvas().currentLayer() but as I said I would like to select one of the loaded raster layers from the qgis legend using a QtGui.QComboBox in the plugin dialog. At the moment I tried the getRasterLayersNames() function I found in several other plugins but it seems I am missing something, because the raster layers are not selectable. Can someone point me to a simple example to understand the general procedure? Thanks a lot Otto ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] select a loaded raster layer from qgis legend into python plugin
Hi Matthias, thanks for your help. I guess it is similar to what I found? def getRasterLayersNames(): layerList = [] layerMap = QgsMapLayerRegistry.instance().mapLayers() for name, layer in layerMap.iteritems(): if layer.type() == QgsMapLayer.RasterLayer and ( layer.usesProvider() and layer.providerKey() == 'gdal' ): layerList.append( unicode( layer.name())) return layerList If I understand correctly your function selects all raster layers from QgsMapLayerRegistry. Now I would like to visualize the layer list in the combobox (InRastA) of the plugin dialog file. I found something that works for vector layers: def manageGui(self): myList = [] self.ui.InRastA.clear() myList = initLayerCombobox() self.ui.InRastA.addItems( myList ) return But is doesn't work for raster that way, if I use your function. How is it possible to make the raster layers selectable / show up in the plugin dialog? Regards Otto Am Thu, 17 Jan 2013 16:21:51 +0100 schrieb Matthias Kuhn matthias.k...@gmx.ch: Hi Otto, here a small extract from a plugin I wrote: Just check for the layer type to only list raster layers def initLayerCombobox(self,combobox, default): reg = QgsMapLayerRegistry.instance() for ( key, layer ) in reg.mapLayers().iteritems(): combobox.addItem( layer.name(), key ) idx = combobox.findData( default ) if idx != -1: combobox.setCurrentIndex( idx ) Regards On Thu, 2013-01-17 at 15:54 +0100, Otto Dassau wrote: Hi, I would like to write a small python plugin to analyse some raster data, but I haven't managed to select a loaded layer yet. I searched the howtos and found several simple examples about: # get the currently active layer layer = self.iface.mapCanvas().currentLayer() but as I said I would like to select one of the loaded raster layers from the qgis legend using a QtGui.QComboBox in the plugin dialog. At the moment I tried the getRasterLayersNames() function I found in several other plugins but it seems I am missing something, because the raster layers are not selectable. Can someone point me to a simple example to understand the general procedure? Thanks a lot Otto ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] select a loaded raster layer from qgis legend into python plugin
Hi Otto, Try this class MyPluginDialog (QDialog,Ui_MyPluginDialog):: def __init__(self): self.setupUi(self) self.initLayerCombobox( self.ui.InRastA, 'key_of_default_layer' ) def initLayerCombobox(self,combobox, default): combobox.clear() reg = QgsMapLayerRegistry.instance() for ( key, layer ) in reg.mapLayers().iteritems(): if layer.type() == QgsMapLayer.RasterLayer and ( layer.usesProvider() and layer.providerKey() == 'gdal' ): combobox.addItem( layer.name(), key ) idx = combobox.findData( default ) if idx != -1: combobox.setCurrentIndex( idx ) Matthias On 01/17/2013 05:07 PM, Otto Dassau wrote: Hi Matthias, thanks for your help. I guess it is similar to what I found? def getRasterLayersNames(): layerList = [] layerMap = QgsMapLayerRegistry.instance().mapLayers() for name, layer in layerMap.iteritems(): if layer.type() == QgsMapLayer.RasterLayer and ( layer.usesProvider() and layer.providerKey() == 'gdal' ): layerList.append( unicode( layer.name())) return layerList If I understand correctly your function selects all raster layers from QgsMapLayerRegistry. Now I would like to visualize the layer list in the combobox (InRastA) of the plugin dialog file. I found something that works for vector layers: def manageGui(self): myList = [] self.ui.InRastA.clear() myList = initLayerCombobox() self.ui.InRastA.addItems( myList ) return But is doesn't work for raster that way, if I use your function. How is it possible to make the raster layers selectable / show up in the plugin dialog? Regards Otto Am Thu, 17 Jan 2013 16:21:51 +0100 schrieb Matthias Kuhn matthias.k...@gmx.ch: Hi Otto, here a small extract from a plugin I wrote: Just check for the layer type to only list raster layers def initLayerCombobox(self,combobox, default): reg = QgsMapLayerRegistry.instance() for ( key, layer ) in reg.mapLayers().iteritems(): combobox.addItem( layer.name(), key ) idx = combobox.findData( default ) if idx != -1: combobox.setCurrentIndex( idx ) Regards On Thu, 2013-01-17 at 15:54 +0100, Otto Dassau wrote: Hi, I would like to write a small python plugin to analyse some raster data, but I haven't managed to select a loaded layer yet. I searched the howtos and found several simple examples about: # get the currently active layer layer = self.iface.mapCanvas().currentLayer() but as I said I would like to select one of the loaded raster layers from the qgis legend using a QtGui.QComboBox in the plugin dialog. At the moment I tried the getRasterLayersNames() function I found in several other plugins but it seems I am missing something, because the raster layers are not selectable. Can someone point me to a simple example to understand the general procedure? Thanks a lot Otto ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] (no subject)
Hi all. Got a strange problem: * import (-o) the .asc file from https://www.dropbox.com/s/w60ywwddl3aj03h/cavallini.zip * r.to.vect (you can see the results of these operations in the location, in the zip above) Display rasters (original and imported) and vector in QGIS. Results: the original raster and the derived vector align perfectly, the imported raster shows shifts while zooming in and out. See attached screenshots as an example. Additionally, in qgis-dev I get errors querying the raster: 168 bytes expected but 320 byte were read from qgis.d.rast Tested on 3 different machines (Debian Unstable, Ubuntu, Windows). Any hint? All the best. -- Paolo Cavallini - Faunalia www.faunalia.eu Full contact details at www.faunalia.eu/pc Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] select a loaded raster layer from qgis legend into python plugin
Hi Matthias, that works. Thanks a lot! Regards Otto Am Thu, 17 Jan 2013 17:24:43 +0100 schrieb Matthias Kuhn matthias.k...@gmx.ch: Hi Otto, Try this class MyPluginDialog (QDialog,Ui_MyPluginDialog):: def __init__(self): self.setupUi(self) self.initLayerCombobox( self.ui.InRastA, 'key_of_default_layer' ) def initLayerCombobox(self,combobox, default): combobox.clear() reg = QgsMapLayerRegistry.instance() for ( key, layer ) in reg.mapLayers().iteritems(): if layer.type() == QgsMapLayer.RasterLayer and ( layer.usesProvider() and layer.providerKey() == 'gdal' ): combobox.addItem( layer.name(), key ) idx = combobox.findData( default ) if idx != -1: combobox.setCurrentIndex( idx ) Matthias On 01/17/2013 05:07 PM, Otto Dassau wrote: Hi Matthias, thanks for your help. I guess it is similar to what I found? def getRasterLayersNames(): layerList = [] layerMap = QgsMapLayerRegistry.instance().mapLayers() for name, layer in layerMap.iteritems(): if layer.type() == QgsMapLayer.RasterLayer and ( layer.usesProvider() and layer.providerKey() == 'gdal' ): layerList.append( unicode( layer.name())) return layerList If I understand correctly your function selects all raster layers from QgsMapLayerRegistry. Now I would like to visualize the layer list in the combobox (InRastA) of the plugin dialog file. I found something that works for vector layers: def manageGui(self): myList = [] self.ui.InRastA.clear() myList = initLayerCombobox() self.ui.InRastA.addItems( myList ) return But is doesn't work for raster that way, if I use your function. How is it possible to make the raster layers selectable / show up in the plugin dialog? Regards Otto Am Thu, 17 Jan 2013 16:21:51 +0100 schrieb Matthias Kuhn matthias.k...@gmx.ch: Hi Otto, here a small extract from a plugin I wrote: Just check for the layer type to only list raster layers def initLayerCombobox(self,combobox, default): reg = QgsMapLayerRegistry.instance() for ( key, layer ) in reg.mapLayers().iteritems(): combobox.addItem( layer.name(), key ) idx = combobox.findData( default ) if idx != -1: combobox.setCurrentIndex( idx ) Regards On Thu, 2013-01-17 at 15:54 +0100, Otto Dassau wrote: Hi, I would like to write a small python plugin to analyse some raster data, but I haven't managed to select a loaded layer yet. I searched the howtos and found several simple examples about: # get the currently active layer layer = self.iface.mapCanvas().currentLayer() but as I said I would like to select one of the loaded raster layers from the qgis legend using a QtGui.QComboBox in the plugin dialog. At the moment I tried the getRasterLayersNames() function I found in several other plugins but it seems I am missing something, because the raster layers are not selectable. Can someone point me to a simple example to understand the general procedure? Thanks a lot Otto ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer -- Geoinformatik Büro Dassau - http://www.gbd-consult.de FOSSGIS consulting , training , support and analysis Ackerstrasse 144c , D - 40233 Düsseldorf , Germany Tel: +49-(0)211-47468178 , Mobile: +49-(0)171-4687540 -- Community Advisor - QGIS Project Steering Committee ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] identify tool for plugins
Hi Denis Thanks for your plugin, it's very useful. When I have a large feature to display and layer isn't in edit mode (edit is disabeld) I can't scroll edit to see all coords, also copy is impossible. Maybe you could replace setEnabled with setReadOnly flag - this would solve problem and prevent user to change something when edit mode of layer is disabled. Also, maybe you could add possibility to add new features to layer from WKT string (something like QuickWKT but adding to existing layer). Regards Peter -- View this message in context: http://osgeo-org.1560.n6.nabble.com/identify-tool-for-plugins-tp5028065p5028198.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] Error connecting QGIS 1.9.0 to Ortho Refresh WCS
I am having trouble using the WCS capability in version 1.9.0 code revision f210668 Here are the full details of the QGIS version from the Help listing: QGIS version1.9.0-MasterQGIS code revision f210668 Compiled against Qt 4.7.1 Running against Qt 4.7.1 Compiled against GDAL/OGR 1.9.2 Running against GDAL/OGR1.9.2 GEOS Version3.3.5 PostgreSQL Client Version 8.3.10 SpatiaLite Version 3.0.1 QWT Version 5.2.1 PROJ.4 Version 480 QScintilla2 Version 2.6.2 This copy of QGIS writes debugging output. The URL that I am connecting to is: http://nis.cubewerx.com/cubewerx/cubeserv.cgi?CONFIG=OIM_Ortho_Refresh_2010DATASTORE=OIM_Ortho_Refresh_2010_store The URL of the GetCapabilities request is: http://nis.cubewerx.com/cubewerx/cubeserv.cgi?CONFIG=OIM_Ortho_Refresh_2010VERSION=1.0.0SERVICE=WCSDATASTORE=OIM_Ortho_Refresh_2010_storeREQUEST=GetCapabilities According to Cubewerx, who is our imagery OGC WCS service provider, their log shows both the GetCapabilities and GetCoverage requests present in the same HTTP request while they should be done separately. This is the request that they are finding in their server log: 2012-11-15 19:06:00.980 10527 received HTTP GET request from 205.200.189.2 to URL http://nis.cubewerx.com/cubewerx/cubeserv.cgi?CONFIG=OIM_Ortho_Refresh_2010DATASTORE=OIM_Ortho_Refresh_2010_storeservice=wcsversion=1.1.1REQUEST=DescribeCoverageCOVERAGE=OIM_Ortho_Refresh_2010_storeSERVICE=WCSREQUEST=GetCapabilitiesAcceptVersions=1.1.0,1.0.0; Is there a fix to this problem available in a later version of QGIS? Here is the error report that I am seeing in QGIS when I try and add this data source to the project: WCS provider: Cannot calculate extent (d:\src\qgis\src\providers\wcs\qgswcsprovider.cpp : 188 : QgsWcsProvider::QgsWcsProvider) Raster layer: Provider is not valid (provider: wcs, URI: cache=AlwaysCachecrs=EPSG:26914format=GeoTIFFidentifier=image_seturl=http://nis.cubewerx.com/cubewerx/cubeserv.cgi?CONFIG% 3DOIM_Ortho_Refresh_2010%26DATASTORE%3DOIM_Ortho_Refresh_2010_store (d:\src\qgis\src\core\raster\qgsrasterlayer.cpp : 1609 : QgsRasterLayer::setDataProvider) Thanks, Bob Bruce From: ekeighan [mailto:ekeig...@cubewerx.com] Sent: January-17-13 3:33 PM To: Bruce, Bob (CON) Subject: Re: Error connecting QGIS 1.9.0 to Ortho Refresh WCS Bob, FYI... ekeig...@cubewerx.com wrote: *Raster layer:* Provider is not valid (provider: wcs, URI: cache=AlwaysCachecrs=EPSG:26914format=GeoTIFFidentifier=image_seturl=http://nis.cubewerx.com/cubewerx/cubeserv.cgi?CONFIG%3DOIM_Ortho_Refresh_2010%26DATASTORE%3DOIM_Ortho_Refresh_2010_store (d:\src\qgis\src\core\raster\qgsrasterlayer.cpp : 1609 : QgsRasterLayer::setDataProvider) Is there something at your end that could be changed to allow this to calculate the extent? Looking through the server log, we see only the following related request present twice: 2012-11-15 19:06:00.980 10527 received HTTP GET request from 205.200.189.2 to URL http://nis.cubewerx.com/cubewerx/cubeserv.cgi?CONFIG=OIM_Ortho_Refresh_2010DATASTORE=OIM_Ortho_Refresh_2010_storeservice=wcsversion=1.1.1REQUEST=DescribeCoverageCOVERAGE=OIM_Ortho_Refresh_2010_storeSERVICE=WCSREQUEST=GetCapabilitiesAcceptVersions=1.1.0,1.0.0; --- This doesn't make any sense, since it contains two different REQUEST arguments, one for DescribeCoverage and another for GetCapabilities. The Qgs error suggests that the base URL it's using is: http://nis.cubewerx.com/cubewerx/cubeserv.cgi?CONFIG%3DOIM_Ortho_Refresh_2010%26DATASTORE%3DOIM_Ortho_Refresh_2010_store but it almost seems as though it was entered improperly as: http://nis.cubewerx.com/cubewerx/cubeserv.cgi?CONFIG=OIM_Ortho_Refresh_2010DATASTORE=OIM_Ortho_Refresh_2010_storeservice=wcsversion=1.1.1REQUEST=DescribeCoverageCOVERAGE=OIM_Ortho_Refresh_2010_store The WCS request received from the client produces an error return, since the server has problems parsing the broken request: ExceptionReport version=1.1.0 xml:lang=en xsi:schemaLocation=http://www.opengis.net/ows/1.1 http://schemas.cubewerx.com/schemas/ows/1.1.0/owsExceptionReport.xsd; Exception exceptionCode=MissingParameterValue locator=identifiers ExceptionTextCubeSERV: Cannot execute WCS request, raised in Wcs_Execute() in file wcs.c line 162/ExceptionText ExceptionTextCubeSERV: Missing parameter identifiers, raised in throwMissingParamError() in file cw_cgiparams.c line 797/ExceptionText /Exception /ExceptionReport The first request from the client should be just a proper GetCapabilities request: