omf_io.pointset.point_set.PointSetIO
- class omf_io.pointset.point_set.PointSetIO(data)[source]
Handles the creation and consumption of PointSet objects with attributes.
- __init__(data)[source]
Initialize the PointSetIO instance.
- Parameters:
data (pandas.DataFrame) – The point set data with a MultiIndex (x, y, z) and attribute columns.
Methods
__init__
(data)Initialize the PointSetIO instance.
from_csv
(file_path)Load a PointSetIO instance from a CSV file.
from_geopandas
(gdf)Create a PointSetIO instance from a GeoDataFrame.
from_omf
(omf_input, pointset_name)Create a PointSetIO instance from an OMF file or project object.
from_ply
(input_file)Create a PointSetIO instance from a PLY file.
from_pyvista
(polydata)Create a PointSetIO instance from a PyVista PolyData object.
to_csv
(output_file)Export the PointSet data to a CSV file.
Convert the PointSetIO data to a GeoDataFrame.
to_omf
([element_name, output_file])Convert the PointSet data to an OMF PointSet, including attributes.
Convert the PointSet data to a pandas DataFrame.
to_ply
(output_file[, binary])Export the PointSet data to a PLY file.
Convert the PointSetIO data to a PyVista PolyData object.
- classmethod from_csv(file_path)[source]
Load a PointSetIO instance from a CSV file.
- Parameters:
file_path (Path) – The path to the CSV file.
- Returns:
An instance of the class.
- Return type:
- classmethod from_geopandas(gdf)[source]
Create a PointSetIO instance from a GeoDataFrame.
- Parameters:
gdf (geopandas.GeoDataFrame) – The input GeoDataFrame with Point geometries.
- Returns:
An instance of the class.
- Return type:
- classmethod from_omf(omf_input, pointset_name)[source]
Create a PointSetIO instance from an OMF file or project object.
- Parameters:
omf_input (Union[Path, omf.Project]) – The input OMF file path or project object.
pointset_name (str) – The name of the PointSet element to extract.
- Returns:
An instance of the class.
- Return type:
- classmethod from_ply(input_file)[source]
Create a PointSetIO instance from a PLY file.
- Parameters:
input_file (Path) – The input PLY file path.
- Returns:
An instance of the class.
- Return type:
- classmethod from_pyvista(polydata)[source]
Create a PointSetIO instance from a PyVista PolyData object.
- Parameters:
polydata (pv.PolyData) – The input PyVista PolyData object.
- Returns:
An instance of the class.
- Return type:
- to_csv(output_file)[source]
Export the PointSet data to a CSV file.
- Parameters:
output_file (Path) – The output CSV file path.
- Return type:
Path
- to_geopandas()[source]
Convert the PointSetIO data to a GeoDataFrame.
- Returns:
A GeoDataFrame with Point geometries.
- Return type:
geopandas.GeoDataFrame
- to_omf(element_name='point_set', output_file=None)[source]
Convert the PointSet data to an OMF PointSet, including attributes.
- Parameters:
element_name (str) – The name of the PointSet element.
output_file (Path, optional) – The file path to save the OMF PointSet.
- Returns:
The OMF PointSet object (if output_file is not provided).
- Return type:
omf.PointSet
- to_pandas()[source]
Convert the PointSet data to a pandas DataFrame.
- Returns:
A DataFrame indexed by (x, y, z) coordinates with attributes.
- Return type:
pandas.DataFrame