mapbox / mapnik-vector-tile

Mapnik implemention of Mapbox Vector Tile specification
BSD 3-Clause "New" or "Revised" License
552 stars 117 forks source link

Features dropping across tiles #284

Closed fullbit-tech closed 6 years ago

fullbit-tech commented 6 years ago

Hello,

I'm running into some odd behavior across tile boundaries. It seems like some features are not continuing into some tiles, but does in others.

Here is an example where you can see some tiles dropping features but not others:

tile-clip

Here is a an example of how it would look if working correctly:

sliced

I was hoping someone could give me an idea of what might be happening during the tile creation process that would cause this. No errors are occurring and the tiles are all loading fine. We've processed a significant amount of layers with no problem, but a handful seem to be having similar issues.

Apologies if the details are light. I'm not sure what would be pertinent but can answer any questions needed.

Versions:

"mapnik@3.5.14", "mapnik-vector-tile@1.2.2",

flippmoke commented 6 years ago

Can you provide an example script to create these tiles?

fullbit-tech commented 6 years ago

We're using a mapbox tilelive implementation, https://github.com/mapbox/mapbox-tile-copy to sync the tiles to s3.

So running a script like the following has successfully reproduced it for me:

var mbTileCopy = require('mapbox-tile-copy');
var file = './6528b73b07ea6ddd2709e279c0f72ca8';
var uri = 's3://test/test_tiles_4/{z}/{x}/{y}.pbf?timeout=10000';

mbTileCopy(file, uri, {
  minzoom: 8,
  maxzoom: 18,
  retry: 3
}, function(err) {
  console.log(err);
});

I think, for the most part, we aren't doing anything novel. It looks like the interface is happening with https://github.com/mapbox/tilelive-bridge which you appear to be contributing to, so you might be able to tell me if I'm barking up the wrong tree.

You can get a copy of the geojson we're using here:

https://s3.amazonaws.com/think-gis-static/6528b73b07ea6ddd2709e279c0f72ca8

Public test endpoint for the generated tiles is:

https://{s}.thinkgis.com/test_tiles_2/{z}/{x}/{y}.pbf

Let me know if there's any other info I can get you. I greatly appreciate your time.

springmeyer commented 6 years ago

@fullbit-tech I just read this and noticed that you said you are using "mapnik-vector-tile@1.2.2",. That is quite old. I would recommend upgrading to the latest version of node-mapnik and them try replicating again.

fullbit-tech commented 6 years ago

@springmeyer I thought this might be an issue, so I updated mapbox-tile-copy to the latest (7.1.0) which uses mapnik@3.7.0 mapnik-vector-tile@1.6.1 but no luck. Still seeing the clipping occurring.

springmeyer commented 6 years ago

@fullbit-tech okay. What zoom level are you seeing the dropped features at?

springmeyer commented 6 years ago

hmm, @fullbit-tech I just noticed that the data you uploaded above uses a GeometryCollection. I would recommend not using that type and its likely that is the problem. Try flattening the data into specific geometry types like Polygon, Point, lineString, etc. Make sure the data looks correct in an application like https://qgis.org/en/site/ when loaded as a GeojSON without a GeometryCollection. Then try again.

fullbit-tech commented 6 years ago

@springmeyer Does this implementation not support GeometryCollections? It looks like support was added? https://github.com/mapbox/mapnik-vector-tile/issues/98#issuecomment-107678474

fullbit-tech commented 6 years ago

@springmeyer I flattened and reprocessed and the clipping is no longer happening. Thank you so much for your help. I'll close this issue, but can you let me know if there are any plans to support GeometryCollections in the future?

Cheers!

springmeyer commented 6 years ago

@springmeyer I flattened and reprocessed and the clipping is no longer happening.

That is great news. Thanks for confirming I guessed right.

@springmeyer Does this implementation not support GeometryCollections? It looks like support was added? #98 (comment) I'll close this issue, but can you let me know if there are any plans to support GeometryCollections in the future?

Nice find. Yes, based on that ticket (which was not still in my memory) it appears we supported GeometryCollection, at least in core mapnik-vector-tile code. So either that regressed or there is a a bug or missing support elsewhere (say in Mapnik core's geojson parser).

To fix this problem we'd need a working testcase. The one you posted above I would not consider "working" because there is no way to know what you expect it to do, or what it should look like. An ideal working testcase would be simplified such that the geometry collection is hand crafted such that is demonstrates a problem but without any extra data that is not needed to replicate. See https://github.com/mapnik/mapnik/wiki/A-perfect-testcase for more details. If you give the time here please create a new issue.

fullbit-tech commented 6 years ago

@springmeyer I'll take a look and see if I can get a cleaner test case for you this week and will create an issue for it. Thanks again!