Skip to content

Instantly share code, notes, and snippets.

@morganherlocker
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save morganherlocker/85916a92f147add000e2 to your computer and use it in GitHub Desktop.

Select an option

Save morganherlocker/85916a92f147add000e2 to your computer and use it in GitHub Desktop.
cover stripe algo
  1. find max and min vertex y of polygon

  2. get tile of max vertex for max_zoom

  3. get intersections of a horizontal line at the tile's y value across the polygon

  4. add tiles from the first intersection (far left) to intersection + 1 (use tilebelt.pointToTile, which is fast)

  5. go to intersection + 2 and repeat [4] until there are no intersections left (this would skip over holes and caves)

  6. go to [3] for the tile one y down until you hit the min vertex tile's y

  7. return all the tiles that were added (first recursively merge tiles up if min_zoom != max_zoom)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment