MapTiles.jl icon indicating copy to clipboard operation
MapTiles.jl copied to clipboard

Add CRS support to tiles and tile grids

Open asinghvi17 opened this issue 5 months ago • 1 comments

Summary

This PR adds explicit CRS (Coordinate Reference System) support to tiles and tile grids, making it clear which coordinate system a tile is using.

Changes

  • Created abstract types AbstractTile and AbstractTileGrid for interface definitions
  • Added CRS field to Tile and TileGrid concrete types
  • Implemented interface functions:
    • crs(tile) - Get the CRS of a tile/grid
    • x(tile), y(tile), z(tile) - Access tile indices
    • zoom(tile) - Alias for z(tile)
    • bounds(tile) - Get bounds in native CRS
    • bounds(tile, target_crs) - Get bounds projected to target CRS
  • Maintained backward compatibility (tiles default to WebMercator when CRS not specified)
  • Added comprehensive test suite for new functionality

Test plan

  • [x] All existing tests pass
  • [x] New tests added for CRS interface (test/test_crs_interface.jl)
  • [x] Type stability tests included
  • [x] Backward compatibility verified

🤖 Generated with Claude Code

asinghvi17 avatar Jul 22 '25 10:07 asinghvi17

does this approach seem fine @rafaqz @visr? Web merc or wgs84 in this package are singletons so the struct should have the same size and no mutability. This was ai generated so I didn't have it try anything fancy.

asinghvi17 avatar Jul 22 '25 14:07 asinghvi17