[Qgis-user] contour&triangulation of 3D data

Pal Schmitt palschmitt at zoho.com
Thu Feb 13 07:40:56 PST 2014


Dear all,
I am investigating the use of QGIS for visualizing depth and current
data, but have run into some unexpected difficulties with a seemingly
standard task.

Until now I used for example paraview to do the following:
3D data in X,Y,Z format
1.) delauny triangulation to create a mesh
2.) applying a colourmap
3.) Applying contours

In many cases a GIS is more suitable and a 2d map is enough, so I tried
to do the follwing in QGIS:
1.) import X,Y,Z data as csv data, creates vector layer

2.) Triangulation creates a mesh, but I don't know how to find my
original Z information for coloring anymore.  Has the data order
changed?

3.) The contour command from the Contour plugin sounds promising, I can
select the variable, range etc. but then I get an error:

An error has occured while executing Python code:

Traceback (most recent call last):
  File "/home/pal/.qgis2/python/plugins/contour/contour.py", line 369,
in accept
    self.makeContours()
  File "/home/pal/.qgis2/python/plugins/contour/contour.py", line 579,
in makeContours
    lines = self.computeContours()
  File "/home/pal/.qgis2/python/plugins/contour/contour.py", line 623,
in computeContours
    cs = plt.tricontour(x, y, z, levels, extend=extend)
  File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 2665,
in tricontour
    ret = ax.tricontour(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 8385, in
tricontour
    return mtri.tricontour(self, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/tri/tricontour.py", line
279, in tricontour
    return TriContourSet(ax, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/tri/tricontour.py", line
35, in __init__
    ContourSet.__init__(self, ax, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/contour.py", line 703,
in __init__
    self._process_args(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/tri/tricontour.py", line
46, in _process_args
    tri, z = self._contour_args(args, kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/tri/tricontour.py", line
81, in _contour_args
    Triangulation.get_from_args_and_kwargs(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/tri/triangulation.py",
line 168, in get_from_args_and_kwargs
    triangulation = Triangulation(x, y, triangles, mask)
  File "/usr/lib/pymodules/python2.7/matplotlib/tri/triangulation.py",
line 71, in __init__
    dt = delaunay.Triangulation(self.x, self.y)
  File
"/usr/lib/pymodules/python2.7/matplotlib/delaunay/triangulate.py", line
90, in __init__
    self.hull = self._compute_convex_hull()
  File
"/usr/lib/pymodules/python2.7/matplotlib/delaunay/triangulate.py", line
125, in _compute_convex_hull
    hull.append(edges.pop(hull[-1]))
KeyError: 4160

Is it a bug or am I doing something obviously wrong? 


4.) I could however create something similar to what I want using the
interpolation plugin and then the raster version of the contour works
fine, but I would much prefer to keep a vector layer.



Any comments shedding some light on points 2 and 3 would be very much
appreciated. I can share my data if anyone wishes to test it, below is a
list of relevant system information.

Cheers,
Pal










Python version:
2.7.3 (default, Sep 26 2013, 20:13:52) 
[GCC 4.6.3]


QGIS version:
2.0.1-Dufour Dufour, exported

Python path: ['/home/pal/.qgis2/python/plugins/processing',
'/usr/share/qgis/python', '/home/pal/.qgis2/python',
'/home/pal/.qgis2/python/plugins', '/usr/share/qgis/python/plugins',
'/usr/local/lib/python2.7/dist-packages/pupynere-1.0.15-py2.7.egg',
'/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PIL',
'/usr/lib/pymodules/python2.7/gtk-2.0',
'/usr/lib/python2.7/dist-packages/gst-0.10',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.7',
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
'/usr/lib/python2.7/dist-packages/ubuntuone-client',
'/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
'/usr/lib/python2.7/dist-packages/ubuntuone-couch',
'/usr/lib/python2.7/dist-packages/ubuntuone-installer',
'/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol',
'/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode',
'/home/pal/.qgis2/python/plugins/DigitizingTools/tools',
'~/.qgis/python', '.', '/usr/share/qgis/python/plugins/fTools/tools',
'/home/pal/QGistest']








More information about the Qgis-user mailing list