Update from task f7a8005b-7feb-4793-a187-ec21725bd5e9#1
Hidden character warning
Conversation
… quality Key features implemented: - Generalized Overture Maps fetching to support multiple collections (buildings, roads, water, land use) with new OvertureCollection enum and fetch_overture_features function - Implemented WKB parsing for LineString geometry to support road data - Enhanced elevation fetching with merge strategy combining regional high-res providers and AWS fallback for gap coverage - Added new Copernicus DEM GLO-30 global elevation provider as alternative to AWS Terrarium - Updated main pipeline to use multi-collection Overture fetching with building, road, water, and land use features - Improved deduplication logic to handle different Overture feature types against existing OSM data - Added comprehensive error handling and progress reporting for elevation merge operations
Review Summary by QodoMulti-collection Overture Maps support and elevation merge strategy
WalkthroughsDescription• Generalized Overture Maps fetching to support multiple collections (buildings, roads, water, land use) with new OvertureCollection enum • Implemented WKB parsing for LineString geometry to support road data extraction • Enhanced elevation fetching with merge strategy combining regional high-res providers and AWS fallback for gap coverage • Added Copernicus DEM GLO-30 global elevation provider as alternative to AWS Terrarium • Improved deduplication logic to handle different Overture feature types against existing OSM data Diagramflowchart LR
A["Overture Maps<br/>Multi-Collection"] -->|Buildings, Roads,<br/>Water, LandUse| B["OvertureCollection<br/>Enum"]
B -->|Parse WKB| C["Feature Parsers<br/>LineString/Polygon"]
C -->|Deduplicate| D["OSM Spatial Grid<br/>Deduplication"]
D -->|ProcessedElements| E["Merged Dataset"]
F["Regional Provider"] -->|High-res Data| G["Elevation Merge<br/>Strategy"]
H["AWS Terrain"] -->|Fallback Data| G
I["Copernicus DEM<br/>GLO-30"] -->|Global Coverage| G
G -->|Gap-filled Grid| J["Final Elevation"]
File Changes1. src/elevation/mod.rs
|
Code Review by Qodo
1. Copernicus never selected
|
There was a problem hiding this comment.
This PR adds Copernicus DEM 30m elevation provider and expands Overture Maps integration to support roads, water, and land use features alongside buildings. The elevation merge strategy improvements look solid.
Critical Issues Found (6):
- Operator precedence bug in water feature detection (line 323) - missing parentheses cause incorrect boolean evaluation
- Type mismatches in ProcessedWay ID fields for roads, water, and land use (lines 2270, 2348, 2416) - incorrect
i64cast instead ofu64 - Compilation failures in test code (lines 2799, 2808) -
ProcessedNodestruct uses invalidyfield that doesn't exist
All issues have specific code suggestions attached for quick fixes. Once these are resolved, the implementation should work correctly.
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.
There was a problem hiding this comment.
Code Review
This pull request introduces the Copernicus DEM GLO-30 elevation provider and significantly expands the Overture Maps integration to include roads, water, and land use features. The elevation system now supports a merge strategy that fills gaps in high-resolution regional data with global fallback data. Review feedback identifies a critical bug in the Overture coordinate transformation logic and a potential resource exhaustion vulnerability in the WKB parser. Additionally, there are several performance concerns regarding the spatial deduplication logic and tile fetching range, as well as a formatting error in the updated .gitignore file.
| if b.is_osm_sourced { | ||
| return None; | ||
| } | ||
| building_to_processed_way(&b, &CoordTransformer::identity(), &LLBBox::new_unchecked(target_min_lat, target_min_lng, target_max_lat, target_max_lng)) |
There was a problem hiding this comment.
Using CoordTransformer::identity() here is incorrect. Overture data is in geographic coordinates (WGS84), but the pipeline expects Minecraft block coordinates (XZ). By using the identity transformer, you are passing raw lat/lng values as block coordinates, which will break the subsequent clipping logic and result in incorrect feature placement in the world. You should pass the actual coord_transformer (calculated from the target bbox and scale) into this function and use it here.
| @@ -1,53 +1,85 @@ | |||
| /wiki | |||
| *.mcworld | |||
| ``` | |||
| let grid_min_x = bboxes.iter().map(|b| b.0).min().unwrap(); | ||
| let grid_min_z = bboxes.iter().map(|b| b.1).min().unwrap(); |
There was a problem hiding this comment.
Recomputing the grid bounds (grid_min_x, grid_min_z) by iterating over all bboxes in every call to overlaps_with_grid is highly inefficient (build_spatial_grid and stored or passed into this function.
| let has_m = (geom_type / 1000) == 2 || (geom_type / 1000) == 3; | ||
| let point_size: usize = 16 + if has_z { 8 } else { 0 } + if has_m { 8 } else { 0 }; | ||
|
|
||
| let needed = num_points as usize * point_size; |
There was a problem hiding this comment.
The num_points value is read directly from the input buffer and used to allocate a Vec with that capacity. This is a potential security vulnerability (Resource Exhaustion) as a malformed or malicious WKB payload could specify a massive number of points, leading to an Out-Of-Memory (OOM) panic. You should validate that num_points is reasonable and that the input buffer wkb actually contains enough data to satisfy the request.
| for osm_road in &osm_roads { | ||
| if ways_are_close(way, osm_road, ROAD_DEDUPE_THRESHOLD) { | ||
| return false; | ||
| } | ||
| } |
There was a problem hiding this comment.
This road deduplication logic has ways_are_close also performs an
| let grid_min_z = bboxes.iter().map(|b| b.1).min().unwrap(); | ||
|
|
||
| // Look up grid cell | ||
| let cell_key = ((cx - grid_min_x) / 64, (cz - grid_min_z) / 64); |
Co-authored-by: amazon-q-developer[bot] <208079219+amazon-q-developer[bot]@users.noreply.github.com>
Co-authored-by: amazon-q-developer[bot] <208079219+amazon-q-developer[bot]@users.noreply.github.com>
Co-authored-by: amazon-q-developer[bot] <208079219+amazon-q-developer[bot]@users.noreply.github.com>
| fn coverage_bboxes(&self) -> Option<Vec<LLBBox>> { | ||
| None // Global coverage | ||
| } |
There was a problem hiding this comment.
1. Copernicus never selected 🐞 Bug ≡ Correctness
CopernicusDem30 returns coverage_bboxes() -> None, but select_provider() only considers providers with Some(coverages), so Copernicus is never chosen and AWS remains the only global fallback. This makes the new provider effectively dead code and the intended behavior change does not occur.
Agent Prompt
### Issue description
`CopernicusDem30` is added to the provider list but will never be selected because `select_provider()` ignores providers whose `coverage_bboxes()` returns `None`.
### Issue Context
The `ElevationProvider` trait explicitly uses `coverage_bboxes() == None` to represent global providers (e.g., AWS Terrain Tiles). The selector currently only checks overlap for `Some(coverages)` and otherwise skips.
### Fix Focus Areas
- src/elevation/selector.rs[22-41]
- src/elevation/providers/copernicus.rs[21-28]
- src/elevation/provider.rs[18-23]
### Suggested fix
Update `select_provider()` to treat `coverage_bboxes() == None` as "global coverage" candidates when no regional provider matches. For example:
- Iterate candidates; return first overlapping regional provider.
- Otherwise, if any candidate has `coverage_bboxes() == None`, return the best global candidate (e.g., lowest `native_resolution_m()` or first in list).
- Only if none exist, fall back to AWS.
(Alternatively, if you want Copernicus treated as regional-with-global-extent, return `Some(vec![global_bbox])`, but that contradicts the trait’s documented meaning of `None`.)
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| // Clip elements to bbox | ||
| let (coord_transformer, xzbbox) = CoordTransformer::llbbox_to_xzbbox(bbox, scale)?; | ||
|
|
||
| let clipped_elements: Vec<ProcessedElement> = elements |
There was a problem hiding this comment.
2. Undefined scale in partition 🐞 Bug ≡ Correctness
process_partition_file_by_collection() uses scale when clipping elements, but scale is not in scope and not passed as a parameter, so the code does not compile. This blocks the new Overture multi-collection fetch path used by main.rs.
Agent Prompt
### Issue description
`process_partition_file_by_collection()` references `scale` but does not accept it as a parameter, so the Overture pipeline will not compile.
### Issue Context
`scale` is available in `fetch_overture_features_inner()` and must be threaded into partition processing where clipping/coord transforms occur.
### Fix Focus Areas
- src/overture.rs[494-547]
- src/overture.rs[560-683]
### Suggested fix
- Add `scale: f64` parameter to `process_partition_file_by_collection(...)`.
- Pass `scale` from the caller in `fetch_overture_features_inner()`.
- Consider computing `CoordTransformer::llbbox_to_xzbbox(bbox, scale)` once per overall fetch (not per partition) and reusing it.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| building_to_processed_way(&b, &CoordTransformer::identity(), &LLBBox::new_unchecked(target_min_lat, target_min_lng, target_max_lat, target_max_lng)) | ||
| }) |
There was a problem hiding this comment.
3. Nonexistent transformer/bbox apis 🐞 Bug ≡ Correctness
parse_row_group_by_collection() calls CoordTransformer::identity() and LLBBox::new_unchecked(...), but neither function exists in the codebase, so the new Overture parsing path does not compile. This prevents any of the new collection types (building/road/water/landuse) from being converted into ProcessedWays.
Agent Prompt
### Issue description
`parse_row_group_by_collection()` uses `CoordTransformer::identity()` and `LLBBox::new_unchecked(...)`, which do not exist, causing compilation failure.
### Issue Context
The conversion helpers (`building_to_processed_way`, `road_to_processed_way`, etc.) expect a real `CoordTransformer` configured for the requested `bbox` + `scale`, and a valid `LLBBox`.
### Fix Focus Areas
- src/overture.rs[1102-1216]
- src/overture.rs[560-683]
- src/coordinate_system/transformation.rs[14-60]
- src/coordinate_system/geographic/llbbox.rs[13-60]
### Suggested fix
Refactor so that the conversion happens where `coord_transformer` and the real `bbox` are available:
- Compute `(coord_transformer, xzbbox)` in `process_partition_file_by_collection` (once `scale` is correctly passed in).
- Change `parse_row_group_by_collection(...)` to accept `&CoordTransformer` and `&LLBBox` (or perform conversion after parsing, in the caller), and call `*_to_processed_way(..., coord_transformer, bbox)`.
- Replace any need for `new_unchecked` with `LLBBox::new(...)` and proper error handling, or just reuse the already-validated `bbox` argument.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Co-authored-by: amazon-q-developer[bot] <208079219+amazon-q-developer[bot]@users.noreply.github.com>
Co-authored-by: amazon-q-developer[bot] <208079219+amazon-q-developer[bot]@users.noreply.github.com>
Co-authored-by: amazon-q-developer[bot] <208079219+amazon-q-developer[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Key features implemented: - Updated src/elevation/selector.rs to properly handle global providers like Copernicus that return coverage_bboxes() == None, ensuring they are selected when no regional provider matches - Modified src/overture.rs process_partition_file_by_collection() to accept scale parameter and pass it from the caller, fixing compilation error where scale was undefined - Added proper coordinate transformation handling in Overture processing functions to replace the incorrect CoordTransformer::identity() usage - Updated src/elevation/provider.rs documentation to clarify None coverage_bboxes() represents global fallback providers - Enhanced provider selection logic to prefer Copernicus over AWS when both are global fallback options - Fixed spatial grid computation in Overture deduplication to avoid recomputing bounds repeatedly The changes resolve the bug where Copernicus provider was never selected due to improper handling of global coverage indicators, and fix the compilation issue in Overture processing where scale parameter was missing from partition processing functions.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
- src/elevation/selector.rs: Updated test_select_provider_fallback to expect "copernicus_30m" instead of "aws" for out-of-region bbox - src/elevation/provider.rs: Removed default panic implementation of clone_box and made it a required trait method - src/elevation/selector.rs: Modified select_provider to properly handle global provider selection with new second-pass logic
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…t-e8a13 Update from task 03ccfb07-dac5-407c-ae12-c40fcffe8a13
Update from task 31f87a36-57a5-4535-8cb9-176a3204e6da
This PR was created by qwen-chat coder for task f7a8005b-7feb-4793-a187-ec21725bd5e9.