ogstools.meshlib.shape_meshing module#

ogstools.meshlib.shape_meshing.read_shape(shapefile, simplify=False, mesh_generator='triangle', cellsize=None)[source]#

Generate a pyvista Unstructured grid from a shapefile.

Parameters:
  • shapefile (str | Path) – Shapefile to be meshed.

  • simplify (bool) – With the Douglas-Peucker algorithm the geometry is simplified. The original line is split into smaller parts. All points with a distance smaller than half the cellsize are removed. Endpoints are preserved. More infos at https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoSeries.simplify.html.

  • mesh_generator (str) – Choose between ‘triangle’ and ‘gmsh’ to generate the mesh.

  • cellsize (int | None) – Size of the cells in the mesh - only needed for simplify algorithm. If None - cellsize is 1/100 of larger bound (x or y).

Returns:

pv.UnstructuredGrid

Return type:

UnstructuredGrid