All Projects → agu3rra → volpy

agu3rra / volpy

Licence: MIT license
Volume Calculations for Digital Elevation Models in Python

Programming Languages

Jupyter Notebook
11667 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to volpy

rabbit-hole
An experimental voxel engine.
Stars: ✭ 39 (+50%)
Mutual labels:  terrain, volume
Volumey
Volume mixer that allows you to set up global hotkeys to control your Windows audio system.
Stars: ✭ 139 (+434.62%)
Mutual labels:  volume
SNAC
Simultaneous Navigation and Construction
Stars: ✭ 13 (-50%)
Mutual labels:  construction
funcd
Daemon for functional keys (works without X11)
Stars: ✭ 14 (-46.15%)
Mutual labels:  volume
Procedural-Terrain-Generator-OpenGL
Procedural terrain generator with tessellation | C++ OpenGL 4.1
Stars: ✭ 98 (+276.92%)
Mutual labels:  terrain
soundfixer
A WebExtension that lets you fix sound problems in e.g. YouTube videos
Stars: ✭ 102 (+292.31%)
Mutual labels:  volume
paragon apfs sdk ce
Paragon APFS SDK Free
Stars: ✭ 97 (+273.08%)
Mutual labels:  volume
GEstimator
GEstimator is a simple civil estimation software written in Python and GTK+. GEstimator can prepare estimates along with rate analysis and supports multiple databases.
Stars: ✭ 17 (-34.62%)
Mutual labels:  construction
moosefs-csi
Container Storage Interface (CSI) for MooseFS
Stars: ✭ 44 (+69.23%)
Mutual labels:  volume
cppcraft
a Minecraft clone written in C++ and OpenGL that includes Minecraft textures, chunks, building, terrain, trees, water, inventories, and more!
Stars: ✭ 75 (+188.46%)
Mutual labels:  terrain
Procedural-Terrain-Generation
3D computer graphics program in C++ OpenFrameworks of a procedural terrain generator based on simplex noise with camera movement and real-time adjustable parameters from the GUI
Stars: ✭ 18 (-30.77%)
Mutual labels:  terrain
ediTable
Manipulation of table (sort, add, edit, remove, etc... - rows | valid cells, type, require, etc... cells )
Stars: ✭ 14 (-46.15%)
Mutual labels:  construction
backup-docker
A simple command line tool to backup and restore docker containers along with their volumes
Stars: ✭ 58 (+123.08%)
Mutual labels:  volume
AsLib
🎨: RPG map maker (paint tool)
Stars: ✭ 82 (+215.38%)
Mutual labels:  terrain
profiletool
Home to the QGis Profiletool plugin. Initial work on this fork was partially funded by the C.A. La Rioja
Stars: ✭ 23 (-11.54%)
Mutual labels:  terrain
blender-terrain
Terrain import is now a part of the blender-osm addon. Get it for free at https://gumroad.com/l/blender-osm
Stars: ✭ 28 (+7.69%)
Mutual labels:  terrain
xdem
Analysis of digital elevation models (DEMs)
Stars: ✭ 50 (+92.31%)
Mutual labels:  digital-elevation-model
Blendpeaks
A free and open source addon for Blender. It creates mountain peaks.
Stars: ✭ 78 (+200%)
Mutual labels:  terrain
Weltenschaft
Open-Source terrain generator 🗺️
Stars: ✭ 41 (+57.69%)
Mutual labels:  terrain
4004-SBC
Home-brew Intel 4004 Single Board Computer
Stars: ✭ 18 (-30.77%)
Mutual labels:  construction

Volume Calculations for Digital Elevation Models in Python (volpy)

Check out this documentation on GitHub Pages! Interactive plots available.

The purpose of this Python project is to provide the means of calculating volumes out of a Digital Elevation Model (DEM) represented by Triangulated Irregular Network (TIN).

Its main goal is to provide sufficiently accurate volume estimates out of terrain surveys for an area of construction work where ground leveling is required prior to the actual construction activity.

Sample contour plot

3D Terrain survey sample

Volume Curves Graph

Installation

$ pip install volpy

Examples

Quick demo

import volpy as vp
vp.demo()

Simple use case

import volpy as vp
survey = vp.load_survey('survey_data.csv')
mesh = vp.terrain_mesh(survey.data)
survey.get_bounds()
> 'x=250.13, y=402.14, z=11.54'
# Survey plots
plots = vp.terrain_plots(survey)
plots.scatter3d()
plots.contour()
plots.profile()
plots.mesh_plot()
vol_curves = mesh.get_volume_curves(step=1.0)
mesh.plot_curves(vol_curves)

# Just a volume from the mesh
mesh.get_volume()

By default, volpy applies its calculations on a Cartesian Coordinate System. If you are working with survey data obtained from a GPS, its points are likely represented in a Geographic Coordinate System. In order to convert it, use the following modifier when loading the data.

>>> survey = vp.load_survey('survey_data.csv', coordinates=vp.CoordinateSystem.GEOGRAPHIC)

Key Definitions

Terrain survey

A process by which points are collected from a terrain of interest in order to form a representation of it.

Ground leveling

In the context of construction, ground leveling is a process by which a given terrain can be re-shaped to a desired projected shape, slope or level. It is usually carried out by the use of heavy machinery to move terrain materials either from the inside the terrain (redistribution of soil) or by using material from the outside.

Cut/Fill volumes

In the context of ground leveling, cut volume refers to terrain material that needs to be removed in order to contribute to re-shape the terrain a new desired state. It is about removing excess. Conversely, fill volumes represent material that needs to be added to the terrain towards achieving this same goal. In practical terms, it is about covering the holes in the terrain.

Volume Calculation Method

During most undergrad studies people are taught how to calculate integrals on a number of different equations. But the real world doesn't give us equations, we need to come up with the equations to model it. This was one of the most delightful pieces of this project: translating a set of points in space into equations and applying basic concepts of linear algebra and integral calculus to them to obtain volumes and cut/fill curves that can be put to practical use in construction work involving earthworks.

In a Nutshell

  1. From points to a triangles.
  2. From triangles to plane equations.
  3. From triangles and planes to a sum of volumes.

Step 1: From points to triangles

The sequence of points in 3D space represented each by an (x,y,z) triplet is grouped in a mesh grid using Delaunay triangulation in the (x,y) coordinates. This process outputs a collection of points grouped in 3 sets of 3d coordinates, each representing a triangular plane in 3d space:
[(xA,yA,zA), (xB,yB,zB), (xC,yC,zC)] = [A,B,C]

This is what it looks like when viewed from the top:
DelaunayTriangulation

Step 2: From triangles to plane equations

The plane equation z=f(x,y) is obtained for each group of 3 distinct points (triangles) in 3d space by applying some basic linear algebra. Given the previous collection of points [A, B, C] in the cartesian system:

  1. Vector AB and BC are determined using their coordinates.
  2. The cross product AB x BC generates a perpendicular vector represented by numerical constants (p,q,r).
  3. Finally the corresponding plane equation is given by:

p*(x-xo) + q*(y-yo) + r*(z-zo) = 0
where (xo,yo,zo) can be any one of the 3 A, B or C points from the plane.

In the GIF below, the ABC triangle is represented by the blue points and the orthonormal vector (p, q, r) is represented by the blue line with an orange tip.

Triangle ABC and normal vector

Step 3: From triangles and planes to a sum of volumes

Given the plane equation, we can isolate z and obtain a z=f(x,y) function on top of which the double integral is applied in order to calculate the volume beneath the triangular plane down until the plane perpendicular to the XY axis that passes by the lowest elevation coordinate (z) of the survey.

The volume of each individual triangle is obtained by the sum of 2 double integrals. So for a triangle with vertices ABC and its plane determined by z=f(x,y) the double integral limits for a single triangular area are determined as follows:
vol_triABC

From GPS to Cartesian Coordinates.

In the event of the terrain survey being executed thru a GPS device (the most common case) an extra step is required prior to applying the volume calculation: map projection.

For the purpose of this project the Universal Traverse Mercator was used to convert from GPS coordinates (latitude, longitude, elevation) to a Cartesian coordinate system which is expected by the algorithm in step 1.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].