I try to get features geometry from a polygon layer. I will insert this geometry into one of my postgis table so I think it would be easier if I export the geometry into WKB format. But sadly I just recognise that
QgsGeometry doesn't support function to export geometry into wkb format (it's just for wkt and geojson).
Here is my script, but it's using
from PyQt4.QtCore import QSettings, QTranslator, qVersion, QCoreApplication from PyQt4.QtGui import QAction, QIcon from qgis.core import QgsMapLayer from qgis.core import QgsFeature, QgsGeometry selectedLayer =iface.mapCanvas().layers() for feature in selectedLayer.getFeatures(): geom = feature.geometry() print geom.exportToWkt()
Any ideas to export this geometry into wkb format ?