Skip to content

Feat/cartesian coordinates#2

Draft
idoaignostics wants to merge 7 commits into
masterfrom
feat/cartesian-coordinates
Draft

Feat/cartesian coordinates#2
idoaignostics wants to merge 7 commits into
masterfrom
feat/cartesian-coordinates

Conversation

@idoaignostics
Copy link
Copy Markdown

@idoaignostics idoaignostics commented Apr 13, 2026

Vibe coded with Claude Code to add support for converting cartesian coordinates, e.g. for WSI analysis results.

  1. New --cartesian projection mode — linear x,y mapping instead of Mercator, aspect-ratio-preserving
  2. --cartesian-extent flag — defines coordinate space bounds, required with --cartesian
  3. Metadata round-trip — cartesian mode/extent saved to MBTiles, auto-detected on decode and tile-join
  4. Disabled world-wrapping for cartesian mode
  5. Used projection->unproject() generically — replaced hardcoded tile2lonlat calls so cartesian projection works through existing pipeline
  6. Added tests
  7. Updated README

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 cartesian projection with --cartesian / --cartesian-extent CLI support in tippecanoe, tippecanoe-decode, and tile-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 before set_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), projection will 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.

Comment thread projection.hpp
struct projection *get_projection(const char *name);

struct sqlite3;
void set_cartesian_from_metadata(sqlite3 *db);
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
void set_cartesian_from_metadata(sqlite3 *db);
void set_cartesian_from_metadata(struct sqlite3 *db);

Copilot uses AI. Check for mistakes.
Comment thread main.cpp
Comment thread README.md
Comment thread README.md
Comment thread decode.cpp
Comment thread decode.cpp
Comment thread tile-join.cpp
Comment thread .idea/vcs.xml Outdated
Comment thread .idea/tippecanoe-cartesian.iml Outdated
Comment thread .idea/modules.xml Outdated
@idoaignostics idoaignostics force-pushed the feat/cartesian-coordinates branch from 2eed5f1 to e6bfd37 Compare April 13, 2026 16:59
…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>
@idoaignostics
Copy link
Copy Markdown
Author

Tested with @davidnelvand if it produces visible results, sadly the answer was no. May be revisited in the future.

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.

3 participants