Skip to content

feat: footprint to tiles (MAPCO-11173) - #101

Merged
almog8k merged 14 commits into
masterfrom
feat/footprint-to-tiles-MAPCO-11173
Aug 31, 2026
Merged

almog8k merged 14 commits into
masterfrom
feat/footprint-to-tiles-MAPCO-11173

Conversation

@almog8k

@almog8k almog8k commented Jul 22, 2026

Copy link
Copy Markdown
Contributor
Question Answer
New feature
Documentation
Tests added

Further information:
Adds a new geometry-only API that computes, for a footprint (Polygon / MultiPolygon / Feature, holes supported) and an inclusive zoom span, all intersecting tiles on the WGS84 geodetic 2:1 grid — emitted lazily as compressed ITileRanges.

How the algorithm works:
The tile pyramid is a quadtree: tile (z, x, y) contains exactly tiles (z+1, 2x..2x+1, 2y..2y+1), so classifying one coarse tile can settle its entire subtree. Starting from the grid's two zoom-0 root tiles, each visited tile is classified by filtering the footprint's edge list against its bounds (Liang-Barsky clipping):

  • No edges cross, center inside → the boundary doesn't pass through the tile, and a tile is a connected region, so it's uniformly inside. Its whole subtree is emitted arithmetically — one range per zoom level, zero further geometry work. This is how a coarse tile stands in for millions of deep ones.
  • No edges cross, center outside → uniformly outside; the whole subtree is pruned.
  • Edges cross → the boundary passes through, so the tile intersects (a polygon includes its boundary). Emit it and recurse into its 4 children, passing only the surviving edges — the edge list shrinks as the descent converges onto the boundary, keeping deep nodes cheap.

Recursion therefore only follows the footprint's boundary: total geometry work is O(boundary tiles at maxZoom) instead of O(bbox area × zoom levels). Interior bulk and exterior bulk are both settled at the coarsest possible level, which is also why memory stays flat — interior subtrees never get expanded, they're expressed as ranges. Point-in-polygon uses the even-odd ray-casting rule, which makes holes and MultiPolygon parts work with no special casing.

@almog8k almog8k changed the title feat: footprint to tiles (mapco-11173) feat: footprint to tiles (MAPCO-11173) Jul 22, 2026
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

🎫 Related Jira Issue: MAPCO-11173

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

Hi it is me, your friendly bot helper! 👋
I've packed this commit for you 😊
You can install it like this:

{
  "dependencies": {
      "@map-colonies/mc-utils": "https://ghatmpstorage.blob.core.windows.net/npm-packages/mc-utils-17f19b20fd2f25603e53a41c4714aa53f7e58b5d.tgz"
  }
}

The link will expire in a week ⌛

@github-actions

Copy link
Copy Markdown

Hi it is me, your friendly bot helper! 👋
I've packed this commit for you 😊
You can install it like this:

{
  "dependencies": {
      "@map-colonies/mc-utils": "https://ghatmpstorage.blob.core.windows.net/npm-packages/mc-utils-279776e6c098547223caa3e89941eb1a2db6650c.tgz"
  }
}

The link will expire in a week ⌛

@CL-SHLOMIKONCHA CL-SHLOMIKONCHA left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

as we discussed, change the span word to more meaningful name, once for zoomRange and once for degreePerTile

Comment thread src/geo/footprintToTileRanges.ts Outdated
Comment thread src/geo/footprintToTileRanges.ts Outdated
Comment thread src/geo/footprintToTileRanges.ts Outdated
@github-actions

Copy link
Copy Markdown

Hi it is me, your friendly bot helper! 👋
I've packed this commit for you 😊
You can install it like this:

{
  "dependencies": {
      "@map-colonies/mc-utils": "https://ghatmpstorage.blob.core.windows.net/npm-packages/mc-utils-f0a390c9448582b50cccab53a5b25e9963ccd25e.tgz"
  }
}

The link will expire in a week ⌛

@github-actions

Copy link
Copy Markdown

Hi it is me, your friendly bot helper! 👋
I've packed this commit for you 😊
You can install it like this:

{
  "dependencies": {
      "@map-colonies/mc-utils": "https://ghatmpstorage.blob.core.windows.net/npm-packages/mc-utils-594e87195f23d153b8b6619e3e69c3f3bf247b0f.tgz"
  }
}

The link will expire in a week ⌛

@github-actions

Copy link
Copy Markdown

Hi it is me, your friendly bot helper! 👋
I've packed this commit for you 😊
You can install it like this:

{
  "dependencies": {
      "@map-colonies/mc-utils": "https://ghatmpstorage.blob.core.windows.net/npm-packages/mc-utils-b961d49970bde77824b53dc5fb98144fe42f4ef8.tgz"
  }
}

The link will expire in a week ⌛

@github-actions

Copy link
Copy Markdown

Hi it is me, your friendly bot helper! 👋
I've packed this commit for you 😊
You can install it like this:

{
  "dependencies": {
      "@map-colonies/mc-utils": "https://ghatmpstorage.blob.core.windows.net/npm-packages/mc-utils-594e87195f23d153b8b6619e3e69c3f3bf247b0f.tgz"
  }
}

The link will expire in a week ⌛

@almog8k
almog8k merged commit 5989b56 into master Aug 31, 2026
5 checks passed
@almog8k
almog8k deleted the feat/footprint-to-tiles-MAPCO-11173 branch August 31, 2026 05:18
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.

2 participants