Skip to content

Conversation

@prgm767
Copy link

@prgm767 prgm767 commented Jan 22, 2026

This makes a pmtiles of the entire world around 10% smaller.

Not sure if the 256 buffer is needed.

This makes a pmtiles of the entire world around 10% smaller.

Not sure if the 256 buffer is needed.
@prgm767
Copy link
Author

prgm767 commented Jan 22, 2026

Please consider merging this.

The motivation for this is that I've noticed that many tiles contain points that are way outside of the tile boundary so they are never actually shown. As far as I can tell these points never influence anything about rendering.

The patch makes a pmtiles-file of the world around 10% smaller,(around 7G).

While the benefit may be considered small, I keep the worldmap on my phone, so saving 7G more than doubled the free space I had available.

The patch accepts points up to 256 units outside of the tile boundaries. I must admit this is probably superstition, I haven't found a tile where it makes any difference.

I am not familiar with the codebase, so please advice if there is a better way of achieving the effect.

@systemed
Copy link
Owner

Thanks - big improvement!

For background on why we have a buffer: https://blog.cyclemap.link/2020-01-25-tilebuffer/ . Issues #215 and #234 covered this.

Currently the buffer is defined by xmargin and ymargin in TileBbox. These are used to define clippingBox which is used for clipping in various places. But I think there's some redundancy in the clipping code so it's very possible we're not doing it optimally.

I'll take a look at this when I get a spare minute, but if you have the chance to see how this works with long, non-90° geometries crossing tile edges, that would help.

@prgm767
Copy link
Author

prgm767 commented Jan 23, 2026

Thank you, this is for points only, not line-segments, which is why I am not sure to include the buffer or not. I'm focusing on points because they often have an associated name and such, so there's a lot to gain by leaving them out.

@pnorman
Copy link
Contributor

pnorman commented Jan 24, 2026

There is no global rule for an appropriate buffer. What you want depends on what is in the layer, the extent, and how the layer is being used. It should be configurable.

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

Successfully merging this pull request may close these issues.

3 participants