Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

[core] support tiles with non-4096 extents - #3766

Merged
ansis merged 1 commit into
masterfrom
variable-extent
Feb 3, 2016
Merged

ansis merged 1 commit into
masterfrom
variable-extent

Conversation

@ansis

@ansis ansis commented Jan 29, 2016

Copy link
Copy Markdown
Contributor

Convert all geometries to the maximum extent supported by our buffers and then use that constant extent everywhere else.

ports 1da1e5ab2bd10ea4d427d4f8dacd77e54f47e0b9 from -js

fixes #250

Only the line extent render test is re-enabled. The rest of the extent render tests have other differences causing them to still fail. I'll work on these separately: #3764 #3765

👀 @jfirebaugh

@jfirebaugh

Copy link
Copy Markdown
Contributor

Are you going to port mapbox/mapbox-gl-js@282a12c? It seems like a good idea.

@bsudekum

Copy link
Copy Markdown

🙇

@ansis

ansis commented Jan 29, 2016

Copy link
Copy Markdown
Contributor Author

@jfirebaugh I think it should be ported separately, later. -native doesn't have an equivalent to Tile that it passes to draw functions. pixelsToTileUnits could be added to TileID in -native or somewhere else, but I think it should be part of a separate push to make -native and -js Tile/TileID/TileCoord objects more similar. #3768

@mb12

mb12 commented Jan 29, 2016

Copy link
Copy Markdown

@ansis Can you please kindly clarify the following?

1.) Since all coordinates are normalized to 13 bit values, is it correct to say that using tiles with extent > 13 bits is not advisable since the higher precision won't be used by the client for rendering?

2.) Under what scenarios should a source return tiles with extent < 8192? Does a lower tile extent reduce size of vector tiles? Is there a specific end user case/bug that this change addresses? I also looked at the gl-js link added by @jfirebaugh but couldn't figure it out.

3.) Should the default value be changed to 8192 here as well?

https://github.com/mapbox/vector-tile-spec/blob/master/2.1/vector_tile.proto

4.) Can you please also confirm that a source can return tiles with variable extents and the client would render them correctly? For e.g. return tiles with extent 512 for zoom less than maxzoom and 8192 for maxzoom.

@ansis

ansis commented Jan 29, 2016

Copy link
Copy Markdown
Contributor Author

@mb12 sure,

  1. Yes, since the client won't use the higher precision there's no point in using tiles with extent > 13 bits (yet). We might be able to bump it up to 16384 or 32768 in the future (see support tiles with extent != 4096 mapbox-gl-js#2010 (comment))

  2. The main reason for implementing support here is that the spec supports non-4096 extents and there are existing tilesets with non-4096 extents (for example, those produced by https://github.com/mapbox/tippecanoe). Yes, I think smaller extents do reduce the size of vector tiles.

  3. Nope. The reasons for 4096 being the default (compromise between precision and size) don't change because of this. It's completely fine to have tiles with extents smaller than the one supported internally.

  4. Yes, different tiles can have different extents. A single tile could even have layers with different extents.

@jfirebaugh

Copy link
Copy Markdown
Contributor

Are we at all performance sensitive about the floating point operations in getGeometries? That's the only thing I would be concerned about.

@ansis

ansis commented Feb 2, 2016

Copy link
Copy Markdown
Contributor Author

The extra work done by getGeometries takes around 1.5% of LineBucket creation time and about 0.5% of FillBucket creation time. Switching to integers speeds it up by about a third (1%, 0.3%) but breaks tiles with extent > util::EXTENT and all theoretical extents that are powers of two. I'm not sure how precise this comparison is because the proportion is different when different data is loaded.

This seems ok, right?

Convert all geometries to the maximum extent supported by our buffers
and then use that constant extent everywhere else.
@ansis
ansis merged commit 4e0d107 into master Feb 3, 2016
@ansis ansis removed the in progress label Feb 3, 2016
@ansis
ansis deleted the variable-extent branch February 3, 2016 01:31
ansis referenced this pull request Feb 25, 2016
GeoJSONTile and AnnotationTile don't need to reimplement getExtent() if
they use the same default value. This also helps point and shape
annotations to avoid using raw values.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support layers with extent != 4096

4 participants