Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix seams on tile borders #34

Merged
merged 4 commits into from Jun 4, 2015
Merged

fix seams on tile borders #34

merged 4 commits into from Jun 4, 2015

Conversation

sevko
Copy link

@sevko sevko commented Jun 3, 2015

This PR fixes the seams that occasionally appear on tile borders, by simplifying geometries before cutting out a tile from them rather than the other way around. Copy-and-pasting my lengthy in-code documentation comment:

Special care must be taken when simplifying certain geometries (like those
in the earth/water layer) to prevent tile border "seams" from forming:
these occur when a geometry is split across multiple tiles (like a
continuous strip of land or body of water) and thus, for any such tile,
the part of that geometry inside of it lines up along one or more of its
edges. If there's any kind of fine geometric detail near one of these
edges, simplification might remove it in a way that makes the edge of the
geometry move off the edge of the tile. See this example of a tile
pre-simplification:
https://cloud.githubusercontent.com/assets/4467604/7937704/aef971b4-090f-11e5-91b9-d973ef98e5ef.png
and post-simplification:
https://cloud.githubusercontent.com/assets/4467604/7937705/b1129dc2-090f-11e5-9341-6893a6892a36.png
at which point a seam formed.

To get around this, for any given tile bounding box, we find the
contained/overlapping geometries and simplify them BEFORE
cutting out the precise tile bounding bbox (instead of cutting out the
tile and then simplifying everything inside of it, as we do with all of
the other layers).

This can be tweaked on a per-layer basis in the TileStache config, by specifying "simplify_before_intersect": true in the kwargs dictionaries.

related PRs: tilezen/vector-datasource#104, tilezen/tilequeue#16

sevko added 3 commits June 2, 2015 10:37
TileStache/Goodies/VecTiles/server.py
	-Fix on-border tile seams by simplifying land/water geometries
	before cutting them out, rather than the other way around (see
	the in-depth documentation comment for elaboration).
	-I jerry-rigged it to do that only for earth/water layers by
	adding a parameter called `layer_name` to `build_query()` and
	checking whether it's equal to "earth" or "water", but this
	should be turned into something that's modifiable in the config.
TileStache/Goodies/VecTiles/server.py
	-Add a `simplify_before_intersect` instance variable to
	`Provider` and `Response`, and an identical parameter to
	`build_query()`. This controls the order of tile
	simplification/cutting in `build_query()`, and can be set in the
	Tilestache config file.
sevko added a commit to tilezen/vector-datasource that referenced this pull request Jun 3, 2015
tilestache.cfg
	-This is necessary for the code-changes that fix tile seams in
	tilezen/TileStache#34 and
	tilezen/tilequeue#16 to kick in.
TileStache/Goodies/VecTiles/server.py
	-If `simplify_before_intersect` is true, then `is_clipped`
	should be true as well by definition; if it's not, it's probably
	a config error, so `assert` that it is.
@rmarianski
Copy link
Member

👍

sevko added a commit that referenced this pull request Jun 4, 2015
@sevko sevko merged commit 60ad37e into integration-1 Jun 4, 2015
@sevko sevko deleted the remove-tile-seams branch June 4, 2015 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants