[Qgis-developer] should I use qgsVectorLayer
Jens Schwarz
jens_schwarz at gmx.de
Fri Aug 5 05:44:08 EDT 2011
Hi All,
I'm developing a little plugin (the first & python-newbie...), which
parses xml and creates a shapefile. The way it work is similar to the
"openAdressesConverter" (but using etree, not sax) - there's a little
dialog asking for the xml-inputpath and the shape-output path. Then click
"ok" and it creates 2 shapefiles yet. It's just working, but the code
needs a big refactoring, but in this moment that's a minor matter (not a
minor matter at all, I know ;)
The things I want to change:
1. There are points and lines in the xml - till now, my code creates for
every layer a single shape file - is it possible, to save those layers (1x
pointlayer(or maybe 2x), 1x LineString layer) directly in one shapefile?
I tried qgsVectorLayer like written in the QGIS1.6-tutorial, but I don't
know how to modify it, because I don't need to use mapCanvas, or
missunderstood the Class Reference. found some small other samples by
google, but didn't help.
2. Is there a method for setting the color of line-Layer? the default
color for the lines should be red at all.
3. the (vector)layer should be added in qgis after creating automaticly,
so you don't have to do it afterwards. Does it work with a simple "def
addLayer" in the end of the code, or is there a better way to to it (maybe
i had a mistake in the code, I tried it with a function using open(path))?
If you have an Idea or if I understood anything wrong , please let me know
-
I didn't found answers by searching here, if there's a topic about this,
please give a link.
thanks,
Jens
More information about the Qgis-developer
mailing list