Export a block diagram as a 3D model (glTF/GLB): ground with the map draped on it, walls and base

Open
#2,319 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
rust

Research direction

Start by reading the existing block implementation in #1914, the mesh work in #2017 and #2084, and the glTF writer used by share.webScene; compare these with imagery.mesh. Define how the command reuses those paths to export the settled block view, then implement and validate geometry, textures, and the no-block error. Done means the four listed tests pass and the result reports the file size and omitted view elements.

Written by the indexing model from the issue text.

Description

Today: a block diagram (map.terrain with "block", #1914) can only be exported as a picture (PNG, PDF) or an orbit (#1916). imagery.mesh writes a DEM as an uncoloured OBJ, and share.webScene writes extruded polygons as glTF, but neither gives the block as it's drawn. A 3D file of the block would open in Blender, PowerPoint, a web viewer or a 3D printer's slicer, and could be turned in class.

Proposal

A new command, map.exportBlock, for a map whose terrain has a block:

map.exportBlock={"path": "pedra_azul.glb", "texture": 4096}
  • Geometry: the ground as the settled view draws it (the same mesh, #2017/#2084, cut to the block), the walls along the block's sides with their top meeting the ground, and the base as a flat quad. The terrain's exaggeration applies; units are metres from the block's south-west corner, with y up as glTF defines.
  • Ground colour: the map drawn top-down over the block's box, at "texture" pixels on the long side (default 4096, at most 8192), as the ground's texture: the same layers, symbology, water (#1915) and labels the map shows, without the relief's light (the 3D viewer lights it).
  • Walls: vertex colours for plain walls; a texture strip per wall when the walls carry a polygon layer's classes and hatches (#1914), drawn as the wall draws them in the map.
  • Format: .glb (binary glTF, one file); .gltf writes the JSON with the buffers and textures embedded. Reuse the glTF writer of share.webScene.
  • Size: the ground's triangles are those of the mesh, at most what the export mesh has; the file's size is given in the result.
  • Notices: what isn't in the model: fog and sky, the relief's shading, labels standing up in screen space (they're in the texture flat instead), the legend and other layout elements.
Tests
  • A block over a small DEM exports a .glb that a glTF validator accepts, with three meshes (ground, walls, base) and a texture.
  • The ground's vertex heights at the corners match the DEM's heights × exaggeration.
  • The walls' top vertices are the ground's edge vertices (no gap).
  • A map with no block is refused with a message.
Choices in this proposal
  • glTF/GLB, not OBJ: one file with textures, read by Blender, PowerPoint, Windows' 3D Viewer and web viewers. OBJ needs a material file and a texture beside it.
  • The map as a texture, unlit: the viewer lights the model, so baking the hillshade in would light it twice.
  • A command of its own: the block is a view setting, not a layer, so it doesn't fit share.webScene's per-layer extrusions; the writer is shared.
  • Related: #1914, #1916, #2017, #2084, imagery.mesh, share.webScene.
Dominant language
Rust
Stars
1.9k
Forks
268
Avg merge
11h 1m
Merged PRs (30d)
942

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from opengeos/RustGIS

All issues in opengeos/RustGIS

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.