Repository navigation
fix(raster-reproject): measure output mode's pixel size away from a center that has none - #717
Merged
Merged
Conversation
…enter that has none Output mode measures its unit, one input pixel's size on the map, at the center of the meshed area. A polar tile whose center is past Web Mercator's latitude limit has no size there, because the clamp collapses it onto the map's top edge, so the reprojector threw and the tile wasn't drawn. When the pixel at the center has no size, the pixel size is now the median of the finite, positive sizes on a 5x5 grid across the meshed area, edges included. Tiles whose center pixel has a size keep their meshes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note that this can increase the number of forward projection calls done to infer the pixel size (up to 100 total forward projection calls), but this is only for tiles whose center is +-85 deg on a web mercator map.
As described by Claude:
Note
This PR was written by Claude (Claude Code), not by @kylebarron.
Output mode (
_errorSpace: "output") measures its unit, one input pixel's size on the map, at the center of the meshed area. Where the pixel there has no size, the reprojector threw, soRasterLayerdrew nothing for that tile.That happens to polar tiles on a Web Mercator map. Web Mercator clamps latitudes past 85.05° onto the map's top edge, so a tile whose center is past that limit, such as an overview tile of an EPSG:3413 or EPSG:3031 COG around the pole, measures a pixel size of 0. Input mode doesn't converge on those tiles either, but it meshes them. So this blocks making output mode the only mode in the layers.
What changes. When the pixel at the center has no size, the reprojector measures across a 5x5 grid over the meshed area, edges and corners included, and uses the median of the sizes that are finite and positive. It throws only if none are. The edges matter: of a 1000 km tile around the pole, only the corners are inside the latitude limit. Tiles whose center pixel has a size keep exactly the meshes they had.
On EPSG:3413 tiles of 256 px, in output mode:
Tests. A map that's flat in a band around the center row gets its pixel size from the grid. A 1000 km polar tile around the pole gets a finite, positive pixel size; this one fails without the grid's edges. A map that's flat everywhere still throws.
🤖 Written by Claude Code