[Qgis-user] python plugin action vs mode tool

Martin Dobias wonder.sk at gmail.com
Thu Jan 17 13:24:02 EST 2008


On Jan 17, 2008 10:07 AM, Düster Horst <Horst.Duester at bd.so.ch> wrote:
>
>
> >gLine = QgsGeometry.fromPolyline( [ QgsPoint(1,1), QgsPoint(2,2) ] )
> ># buffer with distance 0.5, use 5 segments to approximate curves
> >gBuffer = gLine.buffer(0.5, 5)
> >print gBuffer.asPolygon()
>
> The buffer() method is a great starting point to create a geoprocessing
> plugin. At the moment we want to implement a geoprocessing plugin with
> functions like buffer, union, difference etc. At the moment we realised it
> with Shapely. But this approach with third party libs is not nice and would
> be obsolete when QGIS offers the mentioned methods. QGIS native methods()
> based on GEOS would be the much better approach! What are your plans? Do you
> plan to implement union(), difference(), intersect() and relate() as
> QgsGeometry methods?

Since adding the geometry operations is just simple passing the call
to GEOS routines, I've added in r7994 more processing - difference,
union, intersection, convex hull, symmetric difference.
(we're in feature freeze but since these additions don't infere with
any other part of QGIS I think it's ok to add them)


> A second question. I want to create a dissolved buffer polygon. To achieve
> this it is neccessary to combine all single objects p.e. LineStrings to one
> MultiLineString before buffer(). How do I concatenate single Linstrings into
> one Multilinestring?

Well, you can create an instance of QgsMultiPolyline (which is in fact
vector of vectors of points) and export one by one all geometries to
it using QgsGeometry::asPolyline() and then saving them again as
geometry using QgsGeometry::fromMultiPolyline().

So we're expecting a geoprocessing plugin soon ;-)

Bye
Martin



More information about the Qgis-user mailing list