[Qgis-developer] GEOS geometry from QgsGeometry with the Python API?

Martin Dobias wonder.sk at gmail.com
Tue Apr 17 17:27:03 EDT 2012


On Mon, Apr 16, 2012 at 11:00 AM, G. Allegri <giohappy at gmail.com> wrote:
> Hi,
> I've just realized that the python api does't support the
> QgsGeometry.asGeos() method.
> I understand that it would require SIP to manage the marshalling and the
> bindings to GEOS too, so what is the best way to obtain a GEOS geometry from
> the QgsGeoemtry?

Right, it would need some kung-fu across QGIS-GEOS python bindings. It
was never really a top priority for me since QgsGeometry exposes the
most important GEOS geometry algorithms.

> I mean, is there something better then passing through the WKB
> representation and creating a GEOS instance from python?

That's probably the easiest thing right now. Internally, QgsGeometry
is by default stored in WKB anyway.

Martin


More information about the Qgis-developer mailing list