Skip to content

fix: FastBingTileGridGenerator CRS conversion and polygon holes handling - #267

Merged
joshuacortez merged 1 commit into
thinkingmachines:masterfrom
AmmarYasser455:fix/fast-bing-tile-grid-bugs
Feb 28, 2026
Merged

fix: FastBingTileGridGenerator CRS conversion and polygon holes handling#267
joshuacortez merged 1 commit into
thinkingmachines:masterfrom
AmmarYasser455:fix/fast-bing-tile-grid-bugs

Conversation

@AmmarYasser455

Copy link
Copy Markdown
Contributor

Fixes #263

Summary

This PR addresses both bugs reported in issue #263 for FastBingTileGridGenerator:

Bug 1: CRS Conversion (Projected CRS handling)

Problem: When input GeoDataFrame was in a projected CRS (like EPSG:32651), the grid generation produced incorrect results because the algorithm expects lat/lng coordinates.

Solution:

  • Automatically convert input to EPSG:4326 before grid generation
  • Convert output back to the original input CRS
  • Emit warning if input has no CRS set (assumes EPSG:4326)

Bug 2: Polygon Holes (Interior rings)

Problem: Polygons with interior holes caused incorrect grid generation, producing grids over water/holes.

Solution:

  • Detect polygons with interior holes
  • Extract only exterior rings for grid generation
  • Emit warning informing users that holes are ignored
  • Suggest clipping result with original geometry if hole exclusion is needed

Tests Added

  • test_fast_bing_tile_grid_generator_non_4326_crs - Verifies CRS conversion works correctly
  • test_fast_bing_tile_grid_generator_polygon_with_holes - Verifies holes warning is emitted
  • test_fast_bing_tile_grid_generator_no_crs_warning - Verifies missing CRS warning

All Tests Pass

======================== 30 passed in 1.87s ========================

Fixes thinkingmachines#263

**Bug 1: CRS Conversion**
- Input GeoDataFrames in non-EPSG:4326 CRS are now automatically converted
  to EPSG:4326 before grid generation (Bing tiles use lat/lng)
- Output is converted back to the original input CRS
- Warning emitted if input has no CRS set

**Bug 2: Polygon Holes**
- Polygons with interior holes are now detected and handled
- Holes are ignored during grid generation (grids fill entire exterior)
- Warning emitted when holes are detected to inform the user

**Tests Added:**
- test_fast_bing_tile_grid_generator_non_4326_crs
- test_fast_bing_tile_grid_generator_polygon_with_holes
- test_fast_bing_tile_grid_generator_no_crs_warning
@butchtm
butchtm self-requested a review February 28, 2026 02:22
@joshuacortez

Copy link
Copy Markdown
Collaborator

Thank you @AmmarYasser455 !

@joshuacortez joshuacortez reopened this Feb 28, 2026
@joshuacortez
joshuacortez merged commit 81a15d5 into thinkingmachines:master Feb 28, 2026
1 check failed
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.

FastBingTileGridGenerator bugs

3 participants