[Qgis-developer] UPDATE: New Plugin - Edit Any Layer

Kuhn Matthias, Vermessung Matthias.Kuhn at Stadt-Uster.ch
Thu Aug 30 01:40:28 PDT 2012


Hey Rob,
 
I'm trying to get something similar accomplished in another python project and stumbled across a problem your plugin might be affected of as well. I couldn't test it because of an error with character encoding. [1]
I have a layer provided by postgis, where the geometry column is not the last column. The leads to the problem, that any attribute column that comes after the geometry column is shifted by 1 and so are the values. So a table:

A | b | the_geom  | c | d |
---------------------------
1 | 2 | Point(0,0)| 4 | 5 |

Results in a memory layer:

A | b | c | d |
---------------
1 | 2 |   | 4 |

I fixed it by inserting a dummy column at the index where in the original data the geometry column was located. Maybe you can use this in your code as well [2]
 
Regards,
Matthias

[1]: .qgis//python/plugins\EditAnyLayer\editanylayerdialog.py", line 42, in __init__
    print layer.name()
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 3: ordinal not in range(128)
 
[2]:  

curKey = -1
for key, value in fields.iteritems():
  while key != curKey+1:
    pr.addAttributes( [QgsField( "dummy", QVariant.Double )] )
    curKey += 1
  pr.addAttributes([ value ])
  curKey += 1
 


________________________________

	From: qgis-developer-bounces at lists.osgeo.org [mailto:qgis-developer-bounces at lists.osgeo.org] On Behalf Of rob.j.nickerson at gmail.com
	Sent: Wednesday, August 08, 2012 2:22 PM
	To: qgis-developer at lists.osgeo.org
	Subject: [Qgis-developer] UPDATE: New Plugin - Edit Any Layer
	
	
	This plugin has now been uploaded to http://plugins.qgis.org/ and is awaiting approval (thanks Paolo).
	
	Changelog:
	* New icon
	* Added comment to dialogue window
	* Changed menu entry to "Edit Any Layer -> Create Editable Layer..." 
	
	Alister, thanks for the suggestions but, although the name "Copy as memory layer" would explain _what_ the plugin does, I will stick with "Edit Any Layer" as this explains _why_ you would want to run the plugin. I have also not added an option to copy selected items only (and this is low priority as this feature is in QGIS core UI).
	
	Regards,
	Rob



More information about the Qgis-developer mailing list