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

Projection of Geometry {x,y} #4

Closed
hallahan opened this issue Apr 24, 2014 · 10 comments
Closed

Projection of Geometry {x,y} #4

hallahan opened this issue Apr 24, 2014 · 10 comments

Comments

@hallahan
Copy link

When I get a feature and I call feature.loadGeometry();, I get an array of arrays that have values creating lines like this:

{x:4096,y:0},
{x:3726,y:2206}

I thought that the geometry points would be between 0 and 255, because they have been projected to the pixel space of the tile. Apparently I am wrong. If this is pixel space, does it correspond to the zoom that the tiles were cut from? Also, where is the origin?

@springmeyer
Copy link
Contributor

divide by 16 to get the actual pixel space value.

@hallahan
Copy link
Author

Cool. What is the reason to super sample 16x?

@springmeyer
Copy link
Contributor

to avoid precision loss before rounding to integers. This value is configuration at vector tile creation - will plan to doc this out more so I have a place to point you in the spec, but for now just assume 16.

@kkaefer
Copy link
Contributor

kkaefer commented Apr 25, 2014

Note that the extent attribute of the layer contains the actual tile dimensions. In most of our vector tiles, it is 4096, but that is not guaranteed. So when you want to draw the tile to 256x256, you need to do: x * 256 / extent

@hallahan
Copy link
Author

Great! I was wondering what extent meant.

Is this part of the reason why you only need to generate tiles to zoom 12? What is the general approach regarding the dynamic subtiles at higher zoom levels? I suppose it isn't that complicated - just keep slicing it into 4s.

@hallahan
Copy link
Author

hallahan commented Jun 2, 2014

After working a bit in drawing these pbf tiles on HTML5 canvas, I am wondering why we have this extent of 4096. Why super sample atall? It would massively save space if the extent were 256, that way a pixel will have at max 1 node.

After a node has already been rounded to an integer, what is the point of having this super sample?

The reason I am asking, is that if I want to represent millions of points in a given tile, I want to project to a pixel and only have one point for a pixel that in turn represents many points that another API call can query. The browser should not have knowledge about the source points, just the projected points.

@kkaefer
Copy link
Contributor

kkaefer commented Jun 2, 2014

You can set the extent in your layer:

optional uint32 extent = 5 [ default = 4096 ];

@hallahan
Copy link
Author

hallahan commented Jun 2, 2014

I understand this, however, I don't understand why we would ever want something more than the pixel extent of a tile.

I have gotten node-mapnik to render with an extent of 256 when I specify an option for path_multiplier = 1. Then, I make the tolerance be 2 instead of 32. What I wonder is why don't we have 256 be defulat rather than 4096?

@kkaefer
Copy link
Contributor

kkaefer commented Jun 2, 2014

Vector tiles aren't just meant for rendering with Mapnik. You can do lots of other stuff with them, and for those things, a resolution higher than 256 is useful.

@hallahan
Copy link
Author

hallahan commented Jun 2, 2014

ah, i can see how this would be helpful with scaling in opengl. cool!

@kkaefer kkaefer closed this as completed Jun 2, 2014
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

No branches or pull requests

3 participants