[GRASS-dev] vtkGRASSBridge update

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

On Sat, Sep 26, 2009 at 5:01 PM, Soeren Gebbert
<soerengebbert@googlemail.com> wrote:

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/

Congratulations!
I have taken liberty to create a WIKI page:
http://grass.osgeo.org/wiki/GRASS_and_VTK

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

Curiosity: how much faster is this compared to v.delaunay or likewise?

Markus

Hello Markus,

2009/9/26 Markus Neteler <neteler@osgeo.org>:

On Sat, Sep 26, 2009 at 5:01 PM, Soeren Gebbert
<soerengebbert@googlemail.com> wrote:

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/

Congratulations!
I have taken liberty to create a WIKI page:
http://grass.osgeo.org/wiki/GRASS_and_VTK

Thanks :slight_smile:
I will maybe add some content about the project there.
But first i need to add some content to the google code wiki. :wink:
And my time is sooo limited ... :frowning:

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

Curiosity: how much faster is this compared to v.delaunay or likewise?

The VTK Version is twice as fast, but does not write the data back to
grass and therefor
do not build a topology in grass.
The VTK output is base64 XML written to /tmp.

GRASS output:

GRASS 7.0.svn (nc_spm_08):~/src/vtkGRASSBridge/vtk-grass-bridge/Examples

time v.delaunay -r input=elev_lid792_randpts@user1 output=test2 --o

WARNING: Vector map <test2> already exists and will be overwritten
Building topology for vector map <test2>...
Registering primitives...
17948 primitives registered
35896 vertices registered
Building areas...
100%
11949 areas built
1 isles built
Number of nodes: 6000
Number of primitives: 17948
Number of points: 0
Number of lines: 0
Number of boundaries: 17948
Number of centroids: 0
Number of areas: 11949
Number of isles: 1
Number of areas without centroid: 11949
100%
Building topology for vector map <test2>...
Attaching islands...
100%
Attaching centroids...
100%
Number of nodes: 17949
Number of primitives: 29897
Number of points: 0
Number of lines: 0
Number of boundaries: 17948
Number of centroids: 11949
Number of areas: 11949
Number of isles: 1

real 0m2.543s
user 0m2.100s
sys 0m0.392s

GRASS 7.0.svn (nc_spm_08):~/src/vtkGRASSBridge/vtk-grass-bridge/Examples

time python VectorDelaunyTriangulation.py

'vector/elev_lid792_randpts' was found in more mapsets (also found in
<user1>)Using <elev_lid792_randpts@PERMANENT>Debug: Off
Modified Time: 254
Reference Count: 1
Registered Events: (none)
Is Open: True:
  Organisation: NC OneMap
  CreationDate:
  Person: hmitaso
  Title: Rural area (in tile 792), random points from lidar-based DEM
  FullName: elev_lid792_randpts@PERMANENT
  Mapset: PERMANENT
  MapDate: Mon Mar 19 00:37:45 2007
  Scale: 1
  Comment:
  Zone: 0
  Threshold: 0
  Projection: 99
  ProjectionName: Lambert Conformal Conic
  Is 3d: No
  Total number of coor points: 6000

real 0m1.107s
user 0m1.048s
sys 0m0.040s

Best regards
Soeren

Markus