[GRASS-dev] vtkGRASSBridge update

Soeren Gebbert soerengebbert at googlemail.com
Sat Sep 26 11:01:01 EDT 2009


Dear grass devs,
JFYI, i have updated the vtkGRASSBridge to work only with grass7 and added
vector support without topology handling.

The vtkGRASSBridge is hosted on code.google.com as svn repository:
http://code.google.com/p/vtk-grass-bridge/

Here a small python example to triangulate vector points from the nc
demo data set
with the VTK delaunay filter class:

# The purpose of this example is
# to read a grass vector map without topology information
# into the VTK poly data format and processing that map with vtkDelaunay2D.
# The processed data is written as VTK XML file to the file system

# Init grass variables
init = vtkGRASSInit()

# Now build the pipeline
# read the vector map without creating topology
reader = vtkGRASSVectorPolyDataReader() # The reader does not need
topology information
reader.SetVectorName("elev_lid792_randpts")

# Setup the delaunay triangulation
delaunay = vtkDelaunay2D()
delaunay.SetInputConnection(reader.GetOutputPort())

# write the data as XML with base64 encoding
writer = vtkXMLPolyDataWriter()
writer.SetFileName("/tmp/test.vtk")
writer.SetInputConnection(delaunay.GetOutputPort())
writer.Write()


Have fun
Soeren


More information about the grass-dev mailing list