geoutils.PointCloud#
- class geoutils.PointCloud(filename_or_dataset, data_column=None)[source]#
The georeferenced point cloud.
A point cloud is a vector of 2D point geometries associated to numeric values from a main data column, and can also contain auxiliary data columns.
- Main attributes:
- ds:
geopandas.GeoDataFrame Geodataframe of the point cloud.
- data_column: str
Name of point cloud data column.
- crs:
pyproj.crs.CRS Coordinate reference system of the point cloud.
- bounds:
rio.coords.BoundingBox Coordinate bounds of the point cloud.
- ds:
All other attributes are derivatives of those attributes, or read from the file on disk. See the API for more details.
- __init__(filename_or_dataset, data_column=None)[source]#
Instantiate a point cloud from either a data column name and a vector (filename, GeoPandas dataframe or series, or a Shapely geometry), or only with a point cloud file type.
- Parameters:
filename_or_dataset (
str|Path|GeoDataFrame|GeoSeries|BaseGeometry) – Path to vector file, or GeoPandas dataframe or series, or Shapely geometry.data_column (
str|None) – Name of main data column defining the point cloud (not required for LAS/LAZ formats).
Methods
__init__(filename_or_dataset[, data_column])Instantiate a point cloud from either a data column name and a vector (filename, GeoPandas dataframe or series, or a Shapely geometry), or only with a point cloud file type.
affine_transform(matrix)Return a
Vectorwith translated geometries.astype(dtype[, convert_coords, inplace])Convert data type of the point cloud data column.
buffer(distance[, resolution, cap_style, ...])Return a
Vectorof geometries representing all points within a givendistanceof each geometric object.buffer_metric(buffer_size)Buffer the vector features in a local metric system (UTM or UPS).
buffer_without_overlap(buffer_size[, ...])Buffer the vector geometries without overlapping each other.
build_area([node])Create an areal geometry formed by the constituent linework.
clip(mask[, keep_geom_type, sort])Clip points, lines, or polygon geometries to the mask extent.
clip_by_rect(xmin, ymin, xmax, ymax)Return a
Vectorof the portions of geometry within the given rectangle.columns()concave_hull([ratio, allow_holes])Return a
Vectorof geometries representing the concave hull of vertices of each geometry.contains(other[, align])Return a
Seriesofdtype('bool')with valueTruefor each aligned geometry that contains other.contains_properly(other[, align])Return a
Seriesofdtype('bool')with valueTruefor each aligned geometry that is completely insideother, with no common boundary points.copy([new_array])Copy the point cloud in-memory.
count_coordinates()Return a
Seriescontaining the count of the number of coordinate pairs in each geometry.count_geometries()Return a
Seriescontaining the count of geometries in each multi-part geometry.count_interior_rings()Return a
Seriescontaining the count of the number of interior rings in a polygonal geometry.covered_by(other[, align])Return a
Seriesofdtype('bool')with valueTruefor each aligned geometry that is entirely covered by other.covers(other[, align])Return a
Seriesofdtype('bool')with valueTruefor each aligned geometry that is entirely covering other.create_mask([ref, crs, res, bounds, points, ...])Create a raster or point cloud mask from the vector features (True if pixel/point contained by any vector feature, False if not).
crop(crop_geom[, clip, inplace])Crop the vector to given extent.
crosses(other[, align])Return a
Seriesofdtype('bool')with valueTruefor each aligned geometry that cross other.cx()Coordinate based indexer to select by intersection with bounding box.
delaunay_triangles([tolerance, only_edges])Return a
Vectorconsisting of objects representing the computed Delaunay triangulation between the vertices of an input geometry.difference(other[, align])Return a
Vectorof the points in each aligned geometry that are not in other.disjoint(other[, align])Return a
Seriesofdtype('bool')with valueTruefor each aligned geometry disjoint to other.dissolve([by, aggfunc, as_index, level, ...])Dissolve geometries within groupby into single observation.
distance(other[, align])Return a
Seriescontaining the distance to aligned other.dwithin(other, distance[, align])Return a
Seriesofdtype('bool')with valueTruefor each aligned geometry that is within a set distance fromother.estimate_utm_crs([datum_name])Return the estimated UTM CRS based on the bounds of the dataset.
explode([column, ignore_index, index_parts])Explode multi-part geometries into multiple single geometries.
extract_unique_points()Return a
Vectorof MultiPoints representing all distinct vertices of an input geometry.force_2d()Force the dimensionality of a geometry to 2D.
force_3d([z])Force the dimensionality of a geometry to 3D.
frechet_distance(other[, align, densify])Return a
Seriescontaining the Frechet distance to aligned other.from_array(data, crs[, data_column, use_z])Create point cloud from a 3 x N or N x 3 array of X coordinates, Y coordinates and Z values.
from_arrow(table[, geometry])Construct a Vector from an Arrow table object based on GeoArrow extension types.
from_bounds_projected(raster_or_vector[, ...])Create a vector polygon from projected bounds of a raster or vector.
from_dict(data[, geometry, crs])Construct Vector from dict of array-like or dicts by overriding DataFrame.from_dict method with geometry and crs.
from_features(features, crs, columns)Alternate constructor to create Vector from an iterable of features or a feature collection.
from_file(filename, **kwargs)Alternate constructor to create a
Vectorfrom a file.from_postgis(sql, con[, geom_col, crs, ...])Alternate constructor to create a
Vectorfrom a sql query containing a geometry column in WKB representation.from_tuples(tuples_xyz, crs[, data_column, ...])Create point cloud from an iterable of 3-tuples (X coordinate, Y coordinate, Z value).
from_xyz(x, y, z, crs[, data_column, use_z])Create point cloud from three 1D array-like coordinates for X/Y/Z.
geom_equals(other[, align])Return a
Seriesofdtype('bool')with valueTruefor each aligned geometry equal to other.geom_equals_exact(other, tolerance[, align])Return True for all geometries that equal aligned other to a given tolerance, else False.
Check that point cloud X/Y coordinates and CRS are equal.
get_bounds_projected(out_crs[, densify_points])Get vector bounds projected in a specified CRS.
get_coordinates([include_z, ignore_index, ...])get_footprint_projected(out_crs[, ...])Get vector footprint projected in a specified CRS.
get_geometry(index)Return the n-th geometry from a collection of geometries.
get_metric_crs([local_crs_type, method])Get local metric coordinate reference system for the vector (UTM, UPS, or custom Mercator or Polar).
get_precision()Return a
Seriesof the precision of each geometry.get_stats([stats_name])Retrieve specified statistics or all available statistics for the point cloud data.
grid([ref, grid_coords, res, resampling, ...])Grid point cloud into a raster.
hausdorff_distance(other[, align, densify])Return a
Seriescontaining the Hausdorff distance to aligned other.hilbert_distance([total_bounds, level])Calculate the distance along a Hilbert curve.
info([verbose])Summarize information about the vector.
interpolate(distance[, normalized])Return a point at the specified distance along each geometry.
intersection(other[, align])Return a
Vectorof the intersection of points in each aligned geometry with other.intersection_all()Return a geometry containing the intersection of all geometries in the
Vector.intersects(other[, align])Return a
Seriesofdtype('bool')with valueTruefor each aligned geometry that intersects other.is_valid_reason()Return a
Seriesof strings with the reason for invalidity of each geometry.iterfeatures([na, show_bbox, drop_id])Return an iterator that yields feature dictionaries that comply with __geo_interface__.
line_merge([directed])Return (Multi)LineStrings formed by combining the lines in a MultiLineString.
load([columns])Load point cloud from disk (only supported for LAS files).
make_valid()Repairs invalid geometries.
minimum_bounding_circle()Return a
Vectorof geometries representing the minimum bounding circle that encloses each geometry.minimum_bounding_radius()Return a Series of the radii of the minimum bounding circles that enclose each geometry.
minimum_clearance()Return a
Seriescontaining the minimum clearance distance, which is the smallest distance by which a vertex of the geometry could be moved to produce an invalid geometry.minimum_rotated_rectangle()Return a
Vectorof the general minimum bounding rectangle that contains the object.normalize()Return a
Vectorof normalized geometries to normal form (or canonical form).offset_curve(distance[, quad_segs, ...])Return a
LineStringorMultiLineStringgeometry at a distance from the object on its right or its left side.overlaps(other[, align])Return True for all aligned geometries that overlap other, else False.
overlay(right[, how, keep_geom_type, make_valid])Perform spatial overlay between Vectors.
plot([column, ref_crs, cmap, vmin, vmax, ...])Plot the point cloud.
pointcloud_equal(other, **kwargs)Check if two point clouds are equal.
polygonize([node, full])Create polygons formed from the linework of a Vector.
project(other[, normalized, align])Return the distance along each geometry nearest to other.
proximity([raster, size, geometry_type, ...])Compute proximity distances to this vector's geometry.
query(expression[, inplace])Query the vector with a valid Pandas expression.
rasterize([raster, crs, xres, yres, bounds, ...])Rasterize vector to a raster or mask, with input geometries burned in.
relate(other[, align])Return the DE-9IM intersection matrices for the geometries.
relate_pattern(other, pattern[, align])Return True if the DE-9IM string code for the relationship between the geometries satisfies the pattern, else False.
remove_repeated_points([tolerance])Return a
Vectorcontaining a copy of the input geometry with repeated points removed.rename_geometry(col[, inplace])Rename the Vector geometry column to the specified name.
representative_point()Return a
Vectorof (cheaply computed) points that are guaranteed to be within each geometry.reproject([ref, crs, inplace])Reproject vector to a specified coordinate reference system.
reverse()Return a
Vectorwith the order of coordinates reversed.rotate(angle[, origin, use_radians])Return a
Vectorwith rotated geometries.save(filename[, driver, schema, index])Write the vector to file.
scale([xfact, yfact, zfact, origin])Return a
Vectorwith scaled geometries.segmentize(max_segment_length)Return a
Vectorwith vertices added to line segments based on maximum segment length.set_crs([crs, epsg, inplace, allow_override])Set the Coordinate Reference System (CRS) of the
Vector.set_data_column(new_data_column)Set new column as point cloud data column.
set_geometry(col[, drop, inplace, crs])Set the Vector geometry using either an existing column or the specified input.
set_precision([grid_size, mode, inplace])Return a
GeoSerieswith the precision set to a precision grid size.shared_paths(other[, align])Return the shared paths between two geometries.
shortest_line(other[, align])Return the shortest two-point line between two geometries.
simplify(tolerance[, preserve_topology])Return a
Vectorcontaining a simplified representation of each geometry.sjoin(df, *args, **kwargs)Spatial join of two Vectors.
sjoin_nearest(right[, how, max_distance, ...])Spatial join of two Vectors based on the distance between their geometries.
skew([xs, ys, origin, use_radians])Return a
Vectorwith skewed geometries.snap(other, tolerance[, align])Snap the vertices and segments of the geometry to vertices of the reference.
subsample(subsample[, return_indices, ...])Randomly sample the point cloud.
symmetric_difference(other[, align])Return a
Vectorof the symmetric difference of points in each aligned geometry with other.to_array()Convert point cloud to a 3 x N array of X coordinates, Y coordinates and Z values.
to_arrow([index, geometry_encoding, ...])Encode a Vector to GeoArrow format.
to_crs([crs, epsg, inplace])Transform geometries to a new coordinate reference system.
to_csv([path_or_buf, sep, na_rep, ...])Write object to a comma-separated values (csv) file.
to_feather(path[, index, compression, ...])Write a Vector to the Feather format.
to_file(filename[, driver, schema, index])Write the
Vectorto a file.to_geo_dict([na, show_bbox, drop_id])Return a python feature collection representation of the Vector as a dictionary with a list of features based on the
__geo_interface__GeoJSON-like specification.to_json([na, show_bbox, drop_id])Return a GeoJSON representation of the
Vectoras a string.to_las(filename[, version, point_format, ...])Write the point cloud to LAS/LAZ/COPC file.
to_parquet(path[, index, compression, ...])Write a Vector to the Parquet format.
to_postgis(name, con[, schema, if_exists, ...])Upload Vector into PostGIS database.
Convert point cloud to a list of 3-tuples (X coordinate, Y coordinate, Z value).
to_wkb([hex])Encode all geometry columns in the Vector to WKB.
to_wkt(**kwargs)Encode all geometry columns in the Vector to WKT.
to_xyz()Convert point cloud to three 1D arrays of coordinates for X/Y/Z.
touches(other[, align])Return a
Seriesofdtype('bool')with valueTruefor each aligned geometry that touches other.transform(transformation[, include_z])Return a
Vectorwith the transformation function applied to the geometry coordinates.translate([xoff, yoff, zoff, inplace])Shift a vector by a (x,y) offset, and optionally a z offset.
union(other[, align])Return a
Vectorof the union of points in each aligned geometry with other.union_all([method])Return a geometry containing the union of all geometries in the
Vector.vector_equal(other, **kwargs)Check if two vectors are equal.
voronoi_polygons([tolerance, extend_to, ...])Return a
Vectorconsisting of objects representing the computed Voronoi diagram around the vertices of an input geometry.within(other[, align])Return a
Seriesofdtype('bool')with valueTruefor each aligned geometry that is within other.Attributes
active_geometry_nameareaReturn a
Seriescontaining the area of each geometry in theVectorexpressed in the units of the CRS.boundaryReturn a
Vectorof lower dimensional objects representing each geometry's set-theoretic boundary.boundsTotal bounding box of the vector.
centroidReturn a
Vectorof points representing the centroid of each geometry.convex_hullReturn a
Vectorof geometries representing the convex hull of each geometry.Coordinate reference system of the vector.
Data of the point cloud.
Name of data column of the point cloud.
Geodataframe of the point cloud.
envelopeReturn a
Vectorof geometries representing the envelope of each geometry.exteriorReturn a
Vectorof LinearRings representing the outer boundary of each polygon in the Vector.footprintFootprint of the raster.
geom_boundsReturns or appends to
VectoraSerieswith the bounds of each geometry feature.geom_typeReturns a
Seriesof strings specifying the Geometry Type of each object.geometryhas_sindexCheck the existence of the spatial index without generating it.
has_zReturn a
Seriesofdtype('bool')with valueTruefor features that have a z-component.indexinteriorsReturn a
Seriesof List representing the inner rings of each polygon in the Vector.is_ccwReturn a
Seriesofdtype('bool')with valueTrueif a LineString or LinearRing is counterclockwise.is_closedReturn a
Seriesofdtype('bool')with valueTrueif a LineString's or LinearRing's first and last points are equal.is_emptyReturns a
Seriesofdtype('bool')with valueTruefor empty geometries.is_loadedWhether the point cloud data is loaded.
is_maskWhether the point cloud mask is a mask (boolean type).
is_ringReturn a
Seriesofdtype('bool')with valueTruefor features that are closed.is_simpleReturn a
Seriesofdtype('bool')with valueTruefor geometries that do not cross themselves.is_validReturn a
Seriesofdtype('bool')with valueTruefor geometries that are valid.lengthReturn a
Seriescontaining the length of each geometry expressed in the units of the CRS.nameName on disk, if it exists.
Number of points in the point cloud.
sindexGenerate the spatial index.
total_boundsTotal bounds of the vector.