Skip to content

Commit

Permalink
always invert the Y coordinate at the server level - this will break …
Browse files Browse the repository at this point in the history
…tools using client-side {-y} values
  • Loading branch information
sfomuseumbot committed Sep 3, 2024
1 parent 92698e5 commit a98c782
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tile/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ func (p *SimpleTileParser) Parse(path string) (*TileRequest, error) {
x, _ := strconv.ParseUint(match[3], 10, 32)
y, _ := strconv.ParseUint(match[4], 10, 32)

tile := maptile.New(uint32(x), uint32(y), maptile.Zoom(z))
// Just always invert the y coordinate because MBTiles
// https://gist.github.com/tmcw/4954720
// https://stackoverflow.com/questions/46822094/incorrect-coordinates-in-mbtiles-generated-with-tippecanoe

inverted_y := (1 << z) - 1 - y

tile := maptile.New(uint32(x), uint32(inverted_y), maptile.Zoom(z))

tile_req := &TileRequest{
Tile: tile,
Expand Down

0 comments on commit a98c782

Please sign in to comment.