Phstl
Convert GDAL rasters (like GeoTIFF heightmaps) to 3D STL surfaces.
Install / Use
/learn @anoved/PhstlREADME
phstl
Convert GDAL rasters to STL mesh. Intended to produce landscape models from GeoTIFF heightmaps.
Example
Here's a sample GeoTIFF heightmap:

To create a surface mesh from it, type:
phstl example.tif example.stl

By default, the output is scaled such that one mesh unit represents one unit of the input coordinate system. Since the input image resolution is 46 x 38 at about 12.8 feet per pixel (thus an extent of roughly 592 x 482 feet), the output mesh extent is about 580 x 470 units.
To scale the output to fit a certain size, use the -x or -y extent option. To exaggerate vertical relief, use the -z factor option. To anchor the dataset's lowest elevation at Z = 0, use the -c option to automatically clip elevation values. Here's a second example:
phstl -x 100 -z 3 -c example.tif example2.stl

The output surface mesh is not a manifold object. Use another tool to solidify the model in preparation for 3D printing. For examples, see these brief tutorials for Blender or Meshmixer.
Usage
usage: phstl.py [-h] [-x X] [-y Y] [-z Z] [-b BASE] [-c] [-v] RASTER [STL]
Convert a GDAL raster (like a GeoTIFF heightmap) to an STL terrain surface.
positional arguments:
RASTER Input heightmap image
STL Output STL path (stdout)
optional arguments:
-h, --help show this help message and exit
-x X Fit output x to extent (mm)
-y Y Fit output y to extent (mm)
-z Z Vertical scale factor (1)
-b BASE, --base BASE Base height (0)
-c, --clip Clip z to minimum elevation
-v, --verbose Print log messages
--band BAND Raster data band (1)
-m MINIMUM, --minimum MINIMUM
Omit vertices below minimum elevation
-M MAXIMUM, --maximum MAXIMUM
Omit vertices above maximum elevation
Prerequisites
- GDAL/OGR in Python (
sudo easy_install gdal)
License
This project is released under an open source MIT license.
Related Skills
node-connect
345.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
104.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
