Open/save a point cloud

Open/save a point cloud#

This example demonstrates the instantiation of a point cloud through geoutils.PointCloud and saving with save().

import geoutils as gu

We open an example vector.

filename_pc = gu.examples.get_path("coromandel_lidar")
pc = gu.PointCloud(filename_pc, data_column="Z")
pc
PointCloud(
  ds=              Z                         geometry
       0       816.078  POINT (1838933.295 5887999.962)
       1       818.823  POINT (1838930.054 5887999.966)
       2       811.059  POINT (1838933.316 5887999.967)
       3       818.151  POINT (1838928.638 5887999.961)
       4       817.599  POINT (1838926.098 5887999.995)
       ...         ...                              ...
       584343  827.438  POINT (1838913.663 5888000.872)
       584344  825.099  POINT (1838912.806 5888000.715)
       584345  825.419  POINT (1838912.889 5888001.284)
       584346  825.204   POINT (1838912.775 5888000.72)
       584347  822.421  POINT (1838911.847 5888000.565)

       [584348 rows x 2 columns]
  crs=COMPD_CS["NZGD2000 / New Zealand Transverse Mercator 2000 + NZVD2016 height",PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",GEOGCS["NZGD2000",DATUM["New_Zealand_Geodetic_Datum_2000",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6167"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4167"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",173],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",1600000],PARAMETER["false_northing",10000000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Northing",NORTH],AXIS["Easting",EAST],AUTHORITY["EPSG","2193"]],VERT_CS["NZVD2016 height",VERT_DATUM["New Zealand Vertical Datum 2016",2005,AUTHORITY["EPSG","1169"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Gravity-related height",UP],AUTHORITY["EPSG","7839"]]]
  bounds=BoundingBox(left=np.float64(1838792.524), bottom=np.float64(5887910.586), right=np.float64(1838937.061), top=np.float64(5888036.092)))


A point cloud is a subclass of Vector, with a main attribute data_column pointing to the main data column of the point cloud. All other attributes are inherited from Shapely and GeoPandas. See also The georeferenced vector (Vector).

Note

A point cloud can also be instantiated with a geopandas.GeoDataFrame, see From/to GeoPandas.

We can print more info on the point cloud.

Filename:           /home/docs/checkouts/readthedocs.org/user_builds/adebardo-geoutils/checkouts/latest/geoutils/example_data/Coromandel_Lidar/points.laz
Coordinate system:  EPSG:None
Extent:             [1838792.524, 5887910.586, 1838937.061, 5888036.092]
Number of features: 584348
Attributes:         ['Z', 'geometry']

Let’s plot the point cloud main column

pc.plot(cbar_title="Elevation (m)")
read pointcloud

Finally, a point cloud is saved using save().

pc.to_file("mypc.gpkg")

Total running time of the script: (0 minutes 45.492 seconds)

Gallery generated by Sphinx-Gallery