[GRASS-dev] how to use v.clean()?

Hi all,

I am currently developping a plugin for QGis. My input data are shapefiles, and I would like to clean their geometries before doing some processing. v.clean() seems to do the job.
However, I really have no idea on how to:

  1. fill a grass vector layer with geometries readed in a qgis vector layer
  2. call in my (c++) code v.clean()

Could you please help me?

Best regards

Olivier

Olivier Tournaire wrote:

Hi all,
I am currently developping a plugin for QGis. My input data are shapefiles,
and I would like to clean their geometries before doing some processing.
v.clean() seems to do the job.
However, I really have no idea on how to:
1) fill a grass vector layer with geometries readed in a qgis vector layer
2) call in my (c++) code v.clean()

Just for clarification, there is no v.clean() in case you are looking
for some function by this name. I can imagine two ways to achieve your
goal.
The easy way is to simply call the grass modules v.in.ogr (which does
topological polygon cleaning), v.clean for more cleaning, v.out.ogr.
The hard way would be to take the source code of these three modules,
translate it to C++ and adapt it to your needs, if this is possible
from within qgis.

Markus M