Feat/cartesian coordinates#2
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a Cartesian coordinate mode to generate and decode vector tiles using raw x/y coordinates (non-geographic), including metadata propagation and new regression tests.
Changes:
- Introduces a new
cartesianprojection with--cartesian/--cartesian-extentCLI support intippecanoe,tippecanoe-decode, andtile-join. - Stores and auto-detects Cartesian mode/extent via MBTiles metadata, and switches decode/join bounding calculations to use the active projection.
- Adds a Makefile test target plus new Cartesian fixtures and updates README documentation.
Reviewed changes
Copilot reviewed 14 out of 18 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| tile.cpp | Avoids world-wrap clipping behavior at z0 when in Cartesian mode. |
| tile-join.cpp | Switches bbox calculations to projection->unproject, adds Cartesian CLI flags, and attempts metadata auto-detection. |
| projection.hpp | Declares new cartesian APIs, metadata detection helper, and cartesian globals. |
| projection.cpp | Implements cartesian project/unproject, projection lookup, and metadata-based cartesian detection. |
| mbtiles.cpp | Writes cartesian + cartesian_extent metadata when enabled. |
| main.cpp | Adds Cartesian CLI flags, adjusts bbox wrap logic, and uses projection->unproject for derived bounds/center. |
| decode.cpp | Adds Cartesian CLI flags and auto-detects Cartesian mode from MBTiles metadata before decoding. |
| README.md | Documents Cartesian mode and adds decode options; reformats zoom precision table. |
| Makefile | Adds cartesian-test target and includes it in test / fewer-tests. |
| tests/cartesian/*.json, *.mbtiles.json | Adds new fixtures/baselines for Cartesian regression tests. |
| CLAUDE.md | Adds repository guidance for Claude Code. |
| .idea/* | Adds JetBrains IDE project files. |
Files not reviewed (4)
- .idea/.gitignore: Language not supported
- .idea/modules.xml: Language not supported
- .idea/tippecanoe-cartesian.iml: Language not supported
- .idea/vcs.xml: Language not supported
Comments suppressed due to low confidence (1)
tile-join.cpp:655
- These
projection->unproject(...)calls happen beforeset_cartesian_from_metadata(db)is invoked (currently called later in the cleanup loop at ~line 843). If the input tileset is Cartesian and the user relies on metadata auto-detection (no CLI--cartesian),projectionwill still be the default CRS84 here, and the computed bounds/center will be wrong. Move Cartesian metadata detection earlier (e.g., immediately after opening each input DB / reading metadata.json) before any unproject/bounds calculations, and consider erroring out if inputs mix cartesian/non-cartesian metadata.
double lat1, lon1, lat2, lon2;
projection->unproject(r->x, r->y, r->zoom, &lon1, &lat1);
projection->unproject(r->x + 1, r->y + 1, r->zoom, &lon2, &lat2);
minlat = min(lat2, minlat);
minlon = min(lon1, minlon);
maxlat = max(lat1, maxlat);
maxlon = max(lon2, maxlon);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| struct projection *get_projection(const char *name); | ||
|
|
||
| struct sqlite3; | ||
| void set_cartesian_from_metadata(sqlite3 *db); |
There was a problem hiding this comment.
projection.hpp forward-declares struct sqlite3 but declares set_cartesian_from_metadata(sqlite3 *db). sqlite3 is a typedef from sqlite3.h, so this header will fail to compile in translation units that include projection.hpp without including sqlite3.h first (e.g., write_json.cpp). Use struct sqlite3 * in the signature or add a proper typedef struct sqlite3 sqlite3; forward declaration (or include sqlite3.h).
| void set_cartesian_from_metadata(sqlite3 *db); | |
| void set_cartesian_from_metadata(struct sqlite3 *db); |
Agent-Logs-Url: https://github.com/aignostics/tippecanoe-cartesian/sessions/c372e775-ad04-41c5-86a0-13989c312e54 Co-authored-by: idoaignostics <211329344+idoaignostics@users.noreply.github.com>
Agent-Logs-Url: https://github.com/aignostics/tippecanoe-cartesian/sessions/c372e775-ad04-41c5-86a0-13989c312e54 Co-authored-by: idoaignostics <211329344+idoaignostics@users.noreply.github.com>
2eed5f1 to
e6bfd37
Compare
…check extent for PBF decode Agent-Logs-Url: https://github.com/aignostics/tippecanoe-cartesian/sessions/99556fb0-e61a-49a0-9e0a-77ce6e43e373 Co-authored-by: idoaignostics <211329344+idoaignostics@users.noreply.github.com>
|
Tested with @davidnelvand if it produces visible results, sadly the answer was no. May be revisited in the future. |
Vibe coded with Claude Code to add support for converting cartesian coordinates, e.g. for WSI analysis results.
--cartesianprojection mode — linear x,y mapping instead of Mercator, aspect-ratio-preserving--cartesian-extentflag — defines coordinate space bounds, required with --cartesian