Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Python library wrapping the points2grid algorithm for generate Digital Elevation Models (DEMs) from pointclouds. The original points2grid software was developed by the San Diego Supercomputer Center.
pip install pypoints2grid
Note unlike the original C++ version of points2grid, pypoints2grid isn't a command line tool and doesn't read or write data from/to file or handle point cloud classification filtering. Use other libraries, like laspy and rasterio for handeling IO and preparing your data.
from pypoints2grid import points2grid
dem = points2grid(pts, cell_size, bounds=None, radius=0, window_size=3, grid_data=['idw'], verbose=False)
pts: list of lists or numpy array of shape (n, 3) containing x, y, z coordinates of points
cell_size: size of the grid cells in same units as points coordinates.
bounds: list of 4 floats containing the bounds of the grid in the form (xmin, ymin, xmax, ymax). points outside these bounds will be ignored. If None, all points will be included.
radius: radius of the search circle in meters. If 0, the radius will be computed from the cell size.
window_size: size of the window used for the moving average filter. If 0, no moving average filter will be applied. For more information about radius and window_size see the original points2grid documentation
grid_data: list of strings containing the data interpolations you want returned. Possible values are
verbose: if True, print progress information
An (n,m) or (n, m, k) dimensional numpy array containing the interpolated data. n and m are the number of cells in the x and y directions, and k is the number of data interpolations requested. The order of the data interpolations is the same as the order in the grid_data parameter. If k = 1 then the returned array will be 2 dimensional.
A complete script for generating a DEM from a point cloud using laspy and rasterio:
import laspy
import rasterio
import numpy as np
from time import time
from pypoints2grid import points2grid
las = laspy.read("pointcloud.las")
crs = las.header.parse_crs()
# filter out only ground (classififation 2) and water (classification 9)
ground = las.points[(las.classification == 2) | (las.classification == 9)]
pts = np.vstack((ground.x, ground.y, ground.z)).T
x_min, y_min, z_min = pts.min(axis=0)
x_max, y_max, z_max = pts.max(axis=0)
print(f"loaded {pts.shape[0]} points")
print(f"with bounds: ({x_min}, {y_min}), ({x_max}, {y_max})")
cell_size = 0.5
print("creating grid")
start_time = time()
dem = points2grid(pts, cell_size)
print(f"grid created in {round(time() - start_time, 2)} seconds")
transform = rasterio.transform.from_origin(x_min, y_max, cell_size, cell_size)
with rasterio.open(
"dem.tif",
"w",
driver="GTiff",
height=dem.shape[0],
width=dem.shape[1],
count=1,
dtype=dem.dtype,
crs=crs,
transform=transform,
) as dst:
dst.write(dem, 1)
pypoins2grid is licensed under the MIT license. The original points2grid software is licensed under the BSD 4-clause license.
FAQs
implemention of points2grid algorithm
We found that pypoints2grid demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.