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

Tile extent should be 4096 inclusive #32

Closed
nvkelso opened this issue Feb 4, 2016 · 12 comments
Closed

Tile extent should be 4096 inclusive #32

nvkelso opened this issue Feb 4, 2016 · 12 comments
Assignees
Milestone

Comments

@nvkelso
Copy link
Member

nvkelso commented Feb 4, 2016

From the Mapbox spec:

A layer MUST contain an extent that describes the width and height of the tile in integer
coordinates. The geometries within the Vector Tile MAY extend past the bounds of the 
tile's area as defined by the extent. Geometries that extend past the tile's area as defined 
by extent are often used as a buffer for rendering features that overlap multiple adjacent
tiles.

For example, if a tile has an extent of 4096, coordinate units within the tile refer to 1/4096th
of its square dimensions. A coordinate of 0 is on the top or left edge of the tile, and a 
coordinate of 4096 is on the bottom or right edge. Coordinates from 1 through 4095 
inclusive are fully within the extent of the tile, and coordinates less than 0 or greater than 
4096 are fully outside the extent of the tile.  A point at (1,10) or (4095,10) is within the 
extent of the tile. A point at (0,10) or (4096,10) is on the edge of the extent. A point at 
(-1,10) or (4097,10) is outside the extent of the tile.
@nvkelso nvkelso added this to the v0.8.0 milestone Feb 4, 2016
@nvkelso
Copy link
Member Author

nvkelso commented Feb 5, 2016

Related: #33.

@loicgasser
Copy link
Contributor

So they are basically saying that the range of values within a tile is [0, 4096], but then the number of possible values over x or y is 4097 and not 4096. Seems like the doc does not agree with itself.

For example, if a tile has an extent of 4096, coordinate units within the tile refer to 1/4096th

A point at (0,10) or (4096,10) is on the edge of the extent.

Which if these statements should we trust?

@zerebubuth
Copy link
Member

I think it's possible for the doc to agree with itself, if we assume that coordinates are unlike pixels and have zero width. While a bitmap (for example) 10 pixels wide would have positions [0, 9] and width 10, this is because the 9th pixel has a width of 1px. A vector tile 10 "pixels" wide would have positions [0, 10], with each coordinate having zero width, but 1px space between them.

One way of thinking about it might be that pixels in raster images index the squares on a sheet of gridded paper, but the coordinates in vector tiles index the lines which separate the squares.

I think it might be less confusing if the doc were (suggestions in italics):

For example, if a tile has an extent of 4096, the distance between coordinates (which we call a coordinate unit) within the tile refers to 1/4096th of its square dimensions.

A point at (0,10) or (4096,10) is on the edge of the extent.

@loicgasser
Copy link
Contributor

@zerebubuth yes thank you, this makes sense to me now.

@rmarianski
Copy link
Member

Looks like the issue here is that after scaling, we truncate the point, whereas we'd probably want to round instead.

@nvkelso nvkelso added the ready label Feb 9, 2016
@nvkelso
Copy link
Member Author

nvkelso commented Feb 12, 2016

Requires Tangram coordination – will there be overlaps and break boundary detection?

@nvkelso
Copy link
Member Author

nvkelso commented Feb 12, 2016

/cc @bcamper

@bcamper
Copy link
Contributor

bcamper commented Feb 12, 2016

Can we put it on a dev server so we can do a visual check?

@rmarianski
Copy link
Member

Definitely. We haven't implemented the change yet, and will let you know when it's on dev.

@rmarianski
Copy link
Member

@bcamper these changes should be live on dev now

@bcamper
Copy link
Contributor

bcamper commented Feb 23, 2016

Looks good.

@nvkelso
Copy link
Member Author

nvkelso commented Feb 23, 2016

I'll also ask the CartoDB folks to look at dev.

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

No branches or pull requests

5 participants