Skip to content

feat(maptool): add vector tile generation from WRP terrain data#134

Merged
fank merged 1 commit into
mainfrom
feat/maptool-vector-tiles
Feb 5, 2026
Merged

feat(maptool): add vector tile generation from WRP terrain data#134
fank merged 1 commit into
mainfrom
feat/maptool-vector-tiles

Conversation

@fank
Copy link
Copy Markdown
Member

@fank fank commented Feb 5, 2026

Summary

  • Parse OPRW v24/25 WRP files to extract elevation, building objects, and road networks
  • Generate vector.pmtiles via tippecanoe with contour lines (marching squares), building point features, and road polylines as separate vector tile layers
  • Vector tile stage is optional (skips gracefully if tippecanoe missing or WRP parsing fails)

Key implementation details

  • Full WRP binary parser with QuadTree, LZO decompression, and section navigation
  • Contour generation via marching squares algorithm at configurable intervals (10m minor, 50m major)
  • Style.json updated with vector layers when vector.pmtiles exists

Test plan

  • Verify WRP parsing with test data
  • Verify contour generation produces correct GeoJSON
  • Verify pipeline runs end-to-end with tippecanoe installed
  • Verify graceful skip when tippecanoe is missing

Parse OPRW v24/25 WRP files to extract elevation, building objects, and
road networks, then generate vector.pmtiles via tippecanoe. The pipeline
produces contour lines (marching squares), building point features, and
road polylines as separate vector tile layers.

Key implementation details:
- Full WRP binary parser with QuadTree, LZO decompression, and section
  navigation using LZO end-of-stream markers to handle go-lzo's bufio
  overread
- Contour generation via marching squares algorithm at configurable
  intervals (10m minor, 50m major)
- Style.json updated with vector layers when vector.pmtiles exists
- Vector tile stage is optional (skips gracefully if tippecanoe missing
  or WRP parsing fails)
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 5, 2026

Merging this branch will decrease overall coverage

Impacted Packages Coverage Δ 🤖
github.com/OCAP2/web/cmd/ocap-maptool 0.00% (ø)
github.com/OCAP2/web/internal/maptool 12.32% (-0.31%) 👎

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/OCAP2/web/cmd/ocap-maptool/import.go 0.00% (ø) 422 0 422
github.com/OCAP2/web/internal/maptool/contour.go 23.28% (+23.28%) 842 (+842) 196 (+196) 646 (+646) 🌟
github.com/OCAP2/web/internal/maptool/geojson.go 2.33% (+2.33%) 43 (+43) 1 (+1) 42 (+42) 👍
github.com/OCAP2/web/internal/maptool/mbtiles.go 0.00% (ø) 287 (+1) 0 287 (+1)
github.com/OCAP2/web/internal/maptool/metadata.go 21.32% (+1.20%) 197 (+33) 42 (+9) 155 (+24) 👍
github.com/OCAP2/web/internal/maptool/pipeline.go 31.38% (ø) 188 59 129
github.com/OCAP2/web/internal/maptool/scanner.go 26.49% (-0.85%) 151 (+12) 40 (+2) 111 (+10) 👎
github.com/OCAP2/web/internal/maptool/vector.go 4.09% (+4.09%) 538 (+538) 22 (+22) 516 (+516) 👍
github.com/OCAP2/web/internal/maptool/wrp.go 9.94% (-15.06%) 1892 (+1792) 188 (+163) 1704 (+1629) 💀

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/OCAP2/web/internal/maptool/contour_test.go
  • github.com/OCAP2/web/internal/maptool/metadata_test.go
  • github.com/OCAP2/web/internal/maptool/wrp_data_test.go

@fank fank merged commit 6595f7b into main Feb 5, 2026
2 checks passed
@fank fank deleted the feat/maptool-vector-tiles branch February 5, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant