Skip to content

How to define custom TMSs with variableMatrixWidths? #155

Closed Answered by AndrewAnnex
AndrewAnnex asked this question in Q&A
Discussion options

You must be logged in to vote

I ended up doing some work that seems to reproduce the gnosis global grid and wrote some functions that seem to do the job:

import numpy as np 

def coalesing_coefficients(z):
    bottom = 2 ** np.arange(1, z+1)
    return np.concatenate((bottom[::-1], bottom))

def coalesing_tile_rows(z):
    max_row = 2 ** (z + 1) - 1
    top_min_rows = np.concatenate(([0], 2 ** np.arange(z-1)))
    top_max_rows = np.cumsum(top_min_rows)
    bot_max_rows = max_row - top_min_rows
    bot_min_rows = max_row - top_max_rows
    min_rows = np.hstack((top_min_rows, bot_min_rows[::-1]))
    max_rows = np.hstack((top_max_rows, bot_max_rows[::-1]))
    return min_rows, max_rows

def get_variable_matrix_widths(z)…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@vincentsarago
Comment options

@AndrewAnnex
Comment options

Answer selected by AndrewAnnex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants