[Qgis-developer] Points from polygon's geometry vertices

Dominik Fröhlich dominik.froehlich at venus.uni-freiburg.de
Mon Oct 29 07:58:36 PDT 2012


Hi again!

Maybe you could also help me with an other issue: I need to save the 
coordinates of the polygon vertices to a list for later processing. I 
tried with "thepoints = thepoly.asMultiPoint()" but get an empty list.
In the API Documentation I found that the function asMultPoint() needs a 
MultiPoint-geometry as input (what makes no sense to me, as I don't need 
to convert it if it is already MultiPoint…?).

Is there an other function that does what I want, or am I calling the 
asMultiPoint function wrong?

Regards and sorry for disturbing again!

Dominik

On Mon, Oct 29, 2012 at 12:26 PM, Dominik Fröhlich
<dominik.froehlich at venus.uni-freiburg.de>  wrote:

> Der QGIS developers,
>
> I'm trying to write a python plugin to reate input data for one of our
> models. It basicly converts three shape files with special fields to a text
> file.
>
> I have a buildings vector (polygon) layer containing three polygons (which I
> created for testing). This layer is called "build" in the code. To extract
> its geometries, I wrote a little function:
>
> def extract_poly_geometry(self, layer):
> feature = QgsFeature()
> geom_list = []
> while layer.dataProvider().nextFeature(feature):
> geom_list.append(feature.geometry())
> return geom_list



More information about the Qgis-developer mailing list