Skip to content

Add CRS support to tiles and tile grids#48

Open
asinghvi17 wants to merge 3 commits intomainfrom
as/tile-crs
Open

Add CRS support to tiles and tile grids#48
asinghvi17 wants to merge 3 commits intomainfrom
as/tile-crs

Conversation

@asinghvi17
Copy link
Member

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

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

🤖 Generated with Claude Code

asinghvi17 and others added 2 commits July 22, 2025 06:34
- Create abstract types AbstractTile and AbstractTileGrid
- Add CRS field to Tile and TileGrid types
- Implement interface functions: crs(), x(), y(), z(), zoom(), bounds()
- Maintain backward compatibility with default WebMercator CRS
- Add comprehensive tests for CRS functionality
- Update exports to include new interface functions

This allows tiles to store and query their coordinate reference system,
making it explicit which CRS a tile is using rather than implicit.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Replace custom crs() function with GeoInterface.crs()
- Remove crs from exports (users should use GeoInterface.crs)
- Update all usages in code and tests
- This follows Julia ecosystem conventions for geospatial interfaces

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
@asinghvi17
Copy link
Member Author

asinghvi17 commented Jul 22, 2025

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.

- Create TileGridSpec type to define custom tile grids with bbox, zoom, and size
- Add CustomTile type that references a TileGridSpec for flexible tiling
- Add CustomTileGrid type for managing collections of custom tiles
- Implement AbstractTile/AbstractTileGrid interfaces for custom types
- Add create_raster_tiles() helper for tiling raster datasets
- Add comprehensive tests for all custom tile functionality

This allows MapTiles.jl to work with arbitrary tilesets beyond web mercator,
such as tiles generated from raster overviews or custom projections.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
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