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

Tilecover with the same min and max zoom creates unpredictable results #73

Closed
tcql opened this issue Nov 2, 2016 · 8 comments
Closed
Labels

Comments

@tcql
Copy link

tcql commented Nov 2, 2016

screen shot 2016-11-02 at 11 01 03
trying to cover the US with min_zoom:7, max_zoom: 7 - no coastal tiles, and lots of scattered random ones

screen shot 2016-11-02 at 11 28 09
if I generate tiles with min_zoom: 6, max_zoom: 7 then use tilebelt to get the child-tiles for z6 tiles, I get what I was expecting

Interestingly, both runs result in the same number of tiles, which suggests there's just some data flow issue where the coastal tiles get their coordinates scrambled up

@mourner mourner added the bug label Nov 2, 2016
@bkowshik
Copy link
Contributor

I came across a similar issue today with the following code snippet:

// File: index.js
var feature = {"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[77.3440933227539,13.239277104266526],[77.3440933227539,13.239611302005722],[77.34443664550781,13.239611302005722],[77.34443664550781,13.239277104266526],[77.3440933227539,13.239277104266526]]]},"properties":{}};
var tiles = tileCover.geojson(feature.geometry, {min_zoom: 25, max_zoom: 25});
console.log(JSON.stringify(tiles));

I ran the script and piped to tippecanoe and mbview.

node index.js | tippecanoe -pf -pk -fo tileset.mbtiles && mbview tileset.mbtiles -q

screen shot 2016-11-16 at 3 50 22 pm

_Staggered tiles viewed with [mbview](https://github.com/mapbox/mbview)_

screen shot 2016-11-16 at 4 01 09 pm

_Close up view of staggered tiles_

@bkowshik
Copy link
Contributor

Also, I have seen the following behaviour on a couple of occasions. Basically, things are great except a few extra projection tiles somewhere around the corners of the feature that is tile-covered.

screen shot 2016-11-16 at 4 51 14 pm

_A z7 tile covered by z15 tiles_

screen shot 2016-11-16 at 4 51 37 pm

_An extra tile on the top-left corner_

@bkowshik
Copy link
Contributor

bkowshik commented Nov 22, 2016

Added a fixture and a failing test case with: a8fdfe5. The idea behind the fixture is:

  1. When you take a z20 tile as a feature
  2. And tile-cover it with min_zoom and max_zoom limits of 20
  3. You should get the same feature as the tile

I am not sure if this fixture is helpful in creating a fix, but I am documenting it for reference.

screen shot 2016-11-23 at 12 10 00 am

Input fixture on the left and output tiles on the right


cc: @tcql @mourner

@mourner
Copy link
Member

mourner commented Nov 23, 2016

@bkowshik I think this can be an expected output — it may return adjacent tiles because the tile coordinate in mercator is unprojected to latitude/longitude bbox, which is subject to floating point precision errors, and then tiles that had a border exactly matching a tile side can start overlapping it slightly.

However, the cases in the first two comments look like serious bugs.

@mourner
Copy link
Member

mourner commented Nov 28, 2016

@bkowshik It looks like #73 (comment) is different from the original issue, and tile-cover generates the tiles properly but tippecanoe somehow rounds the coordinates because they're so tiny (cc @ericfischer could this be the case?). However, I don't think you should ever use a zoom as high as z25 — it translates to about 30-50cm width for a single tile.

@mourner
Copy link
Member

mourner commented Nov 28, 2016

@tcql I can't reproduce the original issue with the following script — everything looks good:

var tileCover = require('./');
var geojson = require('./test/fixtures/world/USA.geo.json');
var tiles = tileCover.geojson(geojson.features[0].geometry, {min_zoom: 7, max_zoom: 7});
console.log(JSON.stringify(tiles));
node debug.js | geojsonio

Can you set up a broken test case?

@e-n-f
Copy link

e-n-f commented Nov 28, 2016

@mourner Yes, it looks like the misaligned grid is probably from Tippecanoe tiny polygon reduction and could be eliminated with --no-tiny-polygon-reduction, at the cost of probably making the low zooms not work at all. I don't think this could explain the case of the one extra stray tile at the top left, but I'll try some tests and find out.

@mourner
Copy link
Member

mourner commented Dec 14, 2016

@tcql I have to close this as not reproducible on the tile-cover side. Please feel free to reopen after we have a reproducible test case.

@mourner mourner closed this as completed Dec 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants