Skip to content

Add Overpass caching, generation estimation, OSM coverage checks, and improved Overture/WKB parsing#7

Open
tronpis wants to merge 2 commits into
codex/update-comment-for-image-data-handlingfrom
codex/comment-on-overlapping_tiles-function
Open

Add Overpass caching, generation estimation, OSM coverage checks, and improved Overture/WKB parsing#7
tronpis wants to merge 2 commits into
codex/update-comment-for-image-data-handlingfrom
codex/comment-on-overlapping_tiles-function

Conversation

@tronpis
Copy link
Copy Markdown
Owner

@tronpis tronpis commented May 18, 2026

Motivation

  • Speed up repeated area generations by caching Overpass API responses and give users control over caching via CLI and GUI flags.
  • Provide fast, frontend-visible estimates for generation time/disk usage to help users decide on area/scale choices.
  • Warn about low OSM coverage so users can opt for supplementary data when the area is sparse.
  • Improve Overture Maps parsing to support MultiPolygon / Z/M geometry and make WKB parsing more robust against malformed input.

Description

  • Added an estimation module (src/estimation.rs) with estimate_generation and exposed it to the GUI via gui_estimate_generation and printed in the CLI startup in main.rs, plus UI/JS changes (src/gui.rs, src/gui/index.html, src/gui/js/main.js) to show and refresh estimates.
  • Implemented Overpass response caching in src/retrieve_data.rs including overpass_cache_key, load_cached_overpass, save_overpass_cache, cleanup_old_overpass_cache, and a use_cache parameter to fetch_data_from_overpass, added CLI args --use-cache/--no-cache in src/args.rs, and call site updates in main.rs, GUI wiring in gui.rs, and test utility adjustments.
  • Added OSM coverage assessment (src/osm_coverage.rs) with assess_osm_coverage and integrated it into both CLI and GUI flows to emit warnings and a GUI event osm-coverage-warning that the frontend displays; included UI banner and JS listener changes to show contextual messages.
  • Reworked Overture parsing (src/overture.rs) to return multiple building parts, generate stable per-part IDs, and replaced the old parse_wkb_polygon with a more robust WKB parser supporting Polygon, MultiPolygon and dimensional variants (Z/M/ZM) and added defensive checks to prevent resource exhaustion; also small fix in src/elevation/providers/copernicus.rs iterator usage.

Testing

  • Ran unit tests with cargo test, which executed the new tests in src/estimation.rs, src/osm_coverage.rs, and updated src/args.rs tests; all tests passed.
  • Built the project to ensure integration of new modules and GUI bindings with cargo build and the build succeeded.

Codex Task

@qodo-code-review
Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

Copy link
Copy Markdown

@amazon-q-developer amazon-q-developer Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR successfully adds MultiPolygon support for Overture buildings and implements Overpass API caching. The implementation is sound with proper error handling, stable ID generation using part indices, and time-based cache expiry. No blocking issues identified.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several significant features: Overpass API response caching to speed up repeated generations, a generation estimation system for time and disk usage, and an OSM coverage assessment tool that warns users about low-density areas. Additionally, the Overture Maps integration was enhanced to support MultiPolygon geometries and dimensional variants in WKB parsing. Feedback focuses on ensuring the stability of cache keys across compiler updates, fixing a potential ID collision bug when processing Overture building parts, and localizing new UI warning messages.

Comment thread src/retrieve_data.rs

/// Compute a stable-enough cache key for an Overpass query and bbox.
fn overpass_cache_key(bbox: &LLBBox, query: &str) -> String {
let mut hasher = DefaultHasher::new();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

DefaultHasher is not guaranteed to be stable across different Rust compiler versions or platforms. Using it for a persistent on-disk cache means that after a compiler update, existing cache files may become unreachable because their keys (hashes) will change, leading to orphaned files. Consider using a stable hashing algorithm like FNV (already implemented in overture.rs) or a cryptographic hash to ensure cache persistence across updates.

Comment thread src/overture.rs Outdated
Comment thread src/gui/js/main.js
Comment on lines +282 to +290
if (level === "very_low") {
banner.textContent = `⚠ Very low OSM coverage: only ${buildingCount} buildings found in ${areaKm2.toFixed(1)} km². The world may be mostly empty.`;
banner.style.display = "block";
setTimeout(() => { banner.style.display = "none"; }, 10000);
} else if (level === "low") {
banner.textContent = `⚠ Low OSM coverage: ${buildingsPerKm2.toFixed(0)} buildings/km² found. Supplementary data may help fill the area.`;
banner.style.display = "block";
setTimeout(() => { banner.style.display = "none"; }, 8000);
} else {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

These user-facing warning messages are hardcoded in English. To maintain consistency with the project's internationalization efforts, these strings should be moved to the localization JSON files and accessed via window.localization, using placeholders for dynamic values like buildingCount and areaKm2.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant