geovista.core
#
Core geovista
behaviour for processing geolocated meshes.
Notes#
Added in version 0.1.0.
Module Contents#
Classes#
Remesh geolocated mesh along a meridian, from the north-pole to the south-pole. |
|
Enumerate meridian slice bias. |
Functions#
|
Compute and attach texture coordinates, in UV space, to the mesh. |
|
Combine two or more meshes into one mesh. |
|
Change the radius of the spherical mesh. |
|
Cut a cell-based mesh along a meridian, breaking cell connectivity. |
|
Cut a line-based mesh along the Antimeridian, breaking line connectivity. |
|
Cut a mesh along the Antimeridian, breaking connectivities. |
Attributes#
Cartesian west/east bias offset of a slice. |
|
The default number of interpolation points along a spline. |
- class geovista.core.MeridianSlice(mesh, meridian, offset=None)[source]#
Remesh geolocated mesh along a meridian, from the north-pole to the south-pole.
Remeshing involves introducing a seam into the mesh along the meridian of choice, splitting cells bisected by the meridian, which will be triangulated.
Create a meridian seam in the mesh.
The seam extends from the north-pole to the south-pole in a great circle, breaking cell connectivity and thus allowing the geolocated mesh to be correctly projected or texture mapped.
Cells bisected by the meridian of choice will be remeshed i.e., split and triangulated.
- Parameters:
- mesh
PolyData
The geolocated mesh to be remeshed along the meridian.
- meridian
float
The meridian (degrees longitude) along which to create the mesh seam.
- offset
float
, optional Offset buffer around the meridian, used to determine those cells west and east of that are coincident or bisected by the meridian. Defaults to
CUT_OFFSET
.
- mesh
Notes
Added in version 0.1.0.
- extract(bias=None, split_cells=False, clip=True)[source]#
Reduce mesh to only the cells intersecting with the meridian.
Extract the cells participating in the intersection between the meridian (with or without bias) and the mesh.
- Parameters:
- bias
SliceBias
, optional Whether to extract the west, east or exact intersection cells. Defaults to
SliceBias.WEST
.- split_cells
bool
, default=False Determine whether to return coincident whole cells (
=False
) or bisected cells (=True
) of the meridian.- clip
bool
, default=True Determine whether to return the cells of intersection only along the pole-to-pole meridian (
=True
) or along full great circle for this meridian’s longitude (=False
).
- bias
- Returns:
PolyData
The mesh cells from the intersection.
Notes
Added in version 0.1.0.
- east_ids#
- meridian#
- mesh#
- n_cells#
- offset#
- radius#
- slices#
- split_ids#
- west_ids#
- class geovista.core.SliceBias(*args, **kwds)[source]#
Bases:
enum.Enum
Enumerate meridian slice bias.
- EAST#
Preference for a slice to bias cells east of the chosen meridian.
- EXACT#
Preference for a slice to be true to the chosen meridian.
- WEST#
Preference for a slice to bias cells west of the chosen meridian.
- geovista.core.add_texture_coords(mesh, meridian=None, antimeridian=False)[source]#
Compute and attach texture coordinates, in UV space, to the mesh.
Note that, the mesh will be sliced along the meridian to ensure that cell connectivity is appropriately disconnected prior to texture mapping.
- Parameters:
- mesh
PolyData
The mesh that requires texture coordinates.
- meridian
float
, optional The meridian (degrees longitude) to slice along. Defaults to
geovista.common.CENTRAL_MERIDIAN
.- antimeridian
bool
, default=False Whether to flip the given meridian to use its anti-meridian instead.
- mesh
- Returns:
PolyData
The original mesh with inplace texture coordinates attached.
Notes
Added in version 0.1.0.
- geovista.core.combine(*meshes, data=True, clean=False)[source]#
Combine two or more meshes into one mesh.
Only meshes with cells will be combined. Support is not yet provided for combining meshes that consist of only points or lines.
Note that, no check is performed to ensure that mesh cells do not overlap. However, meshes may share coincident points. Coincident point data from the first input mesh will overwrite all other mesh data sharing the same coincident point in the resultant mesh.
- Parameters:
- *meshesiterable of
PolyData
The meshes to be combined into a single
PolyData
mesh.- data
bool
, default=True Whether to also combine and attach common data from the meshes onto the resultant mesh.
- clean
bool
, default=False Specify whether to merge duplicate points, remove unused points, and/or remove degenerate cells in the resultant mesh. See
pyvista.PolyDataFilters.clean()
.
- *meshesiterable of
- Returns:
Notes
Added in version 0.1.0.
- geovista.core.resize(mesh, radius=None, zlevel=None, zscale=None, inplace=False)[source]#
Change the radius of the spherical mesh.
- Parameters:
- mesh
PolyData
The mesh to be resized to the provided
radius
.- radius
float
, optional The target radius of the
mesh
. Defaults togeovista.common.RADIUS
.- zlevel
int
, default=0 The z-axis level. Used in combination with the zscale to offset the radius by a proportional amount i.e.,
radius * zlevel * zscale
.- zscale
float
, optional The proportional multiplier for z-axis zlevel. Defaults to
geovista.common.ZLEVEL_SCALE
.- inplace
bool
, default=False Update mesh in-place.
- mesh
- Returns:
PolyData
The resized mesh.
Notes
Added in version 0.1.0.
- geovista.core.slice_cells(mesh, meridian=None, antimeridian=False, rtol=None, atol=None)[source]#
Cut a cell-based mesh along a meridian, breaking cell connectivity.
Create a seam along the meridian of the geolocated mesh, from the north-pole to the south-pole, breaking cell connectivity thus allowing the mesh to be correctly transformed (projected) or texture mapped.
Cells bisected by the meridian of choice will be remeshed i.e., split and triangulated.
- Parameters:
- mesh
PolyData
The mesh to be sliced along the meridian.
- meridian
float
, optional The meridian (degrees longitude) to slice along. Defaults to
geovista.common.CENTRAL_MERIDIAN
.- antimeridian
bool
, default=False Whether to flip the given meridian to use its anti-meridian instead.
- rtol
float
, optional The relative tolerance for longitudes close to the ‘wrap meridian’ - see
geovista.common.wrap()
for more.- atol
float
, optional The absolute tolerance for longitudes close to the ‘wrap meridian’ - see
geovista.common.wrap()
for more.
- mesh
- Returns:
PolyData
The mesh with a seam along the meridian and remeshed cells, if bisected.
Notes
Added in version 0.1.0.
- geovista.core.slice_lines(mesh, n_points=None, copy=False)[source]#
Cut a line-based mesh along the Antimeridian, breaking line connectivity.
The connectivity of any line segment in the mesh traversing the Antimeridian will be broken. Each end-point of the segment will be connected to a new interior point, located at the point of intersection between the line segment and the Antimeridian i.e., the segment will be split into two separate, disjointed segments. If the end-point of a segment lies on the Antimeridian, then it is replaced with an identical but distinct co-located point.
This operation is typically performed prior to reprojection in order to create a seam in the line segments.
The mesh is sliced with a
z-x
plane formed by extruding a line on the x-axis along the z-axis.- Parameters:
- mesh
PolyData
The line mesh that requires to be sliced.
- n_points
int
, optional The number of intermediate points for the line that will be extruded to form a plane which will slice the mesh e.g., with
n_points=1
, a mid-point will be calculated for the line, which will then consist of 2 line segments i.e., the 2 end-points and 1 mid-point. Defaults toSPLINE_N_POINTS
.- copy
bool
, default=False Return a deepcopy of the
mesh
when there are no points of intersection with the Antimeridian. Otherwise, the originalmesh
is returned.
- mesh
- Returns:
PolyData
The line mesh with a seam along the Antimeridian, if bisected.
Notes
Added in version 0.3.0.
- geovista.core.slice_mesh(mesh, rtol=None, atol=None)[source]#
Cut a mesh along the Antimeridian, breaking connectivities.
A point-cloud cannot be sliced as there are no cells or lines, and will be returned unaltered. Otherwise, a new instance of the mesh will be returned regardless of whether it has been bisected or not.
Basically calls
slice_cells()
orslice_lines()
, depending on the mesh type.- Parameters:
- mesh
PolyData
The mesh that requires to be sliced.
- rtol
float
, optional The relative tolerance for longitudes close to the ‘wrap meridian’ - see
geovista.common.wrap()
for more.- atol
float
, optional The absolute tolerance for longitudes close to the ‘wrap meridian’ - see
geovista.common.wrap()
for more.
- mesh
- Returns:
PolyData
The mesh with a seam along the Antimeridian, if bisected.
Notes
Added in version 0.3.0.