Web app for visualizing geophysical data

Hi there,

I’m trying to develop a web application for visualizing 3D geophysical data. This data would be either in form of .vtk profiles, or .tiff maps.

I created a basic example using pyvista (and trame in the background) that works locally.

When trying to set it on a server, I found out about Glance. Glance seems to do everything I was trying to get my app doing…Now I’m wondering if I could generate a .vtkjs or .glance file from my python script, that I would then import in Glance.

I tried the following code which seems to work :

# Create PyVista plotter
pl = pv.Plotter()

# Create and add cone
cone = pv.Cone()
pl.add_mesh(cone)

# Force render
pl.reset_camera()
pl.render()

# Get render window
render_window = pl.render_window

# Export scene
from vtkmodules.vtkIOExport import vtkJSONSceneExporter
exporter = vtkJSONSceneExporter()
exporter.SetFileName('test.vtkjs')
exporter.SetRenderWindow(render_window)
exporter.Write()

But when trying with my own vtk meshes, it creates the following file which I can’t open in Glance
https://filesender.renater.fr/?s=download&token=6ff804b0-750f-44a3-bbcf-77182ea3f8d3

I don’t know if that makes any sense.
I can code in Python, but I don’t know much about JS.

Thanks

It is because you exported a vtkUnstructuredGrid. Glance (and VTK.js under the hood) can only support vtkPolyData (surface meshes).

You would need to use a vtkGeometryFilter to extract the outer surface of your mesh.

HTH