Skip to content

Added function to calculate a quadtree in a tile

Karsten Prehn requested to merge feature/tilegrid-function-quadtree into main

This adds a function tile_quadtree to the tilegrid class, plus some small helper functions scattered across all class modules, plus a whole lot of test functions.

tile_quadtree takes a set of leafs (e.g. 4 level 18 tiles that are known to be coastal from previous steps) and calculates the quadtree upwards until an existing database tile or a stop threshold is hit. The function then returns a list of (new) quadkeys to update or insert (upsert) to the database and existing ones that have to be removed. The function results come in the form of a dictionary, e.g.

{'upsert': ['120210023223301020',
  '120210023223301021',
  '120210023223301022',
  '120210023223301023',
  '12021002322330100',
  '12021002322330101',
  '12021002322330103',
  '1202100232233011',
  '1202100232233012',
  '1202100232233013'],
 'remove': [('120210023223301', 0)]}

Graphically this quad-tree looks like so:

quadtree

\approve @ds @marius

Merge request reports

Loading