5

I'm new to mapping and I'm looking to self-host some PBF-based vector tile files, mainly for a hybrid mobile app (Phonegap, HTML5, Openlayers or Mapbox-GL-JS).

If I need to generate or pre-render Vector-based PBF files (from OSM data), do I need to specify the 'XYZ'-Zoom level in the PBF filename (e.g. ''), If so, could anybody explain why?

To my uninitiated, noob instinct, the very nature of vector map files suggest that zooming/scaling shouldn't require multiple files for a given tile, I can understand that where bitmap/raster graphics are concerned.

2 Answers 2

7

Yes, you do need separate vector tiles for each zoom level, for two main reasons:

1) A low-zoom vector tile doesn't necessarily contain every feature within it. Depending how the vector tiles are generated, usually data is dropped to keep the size of each tile manageable (eg, under 500KB for Mapbox Vector Tiles). Mapbox Tippecanoe is one tool that specialises in this.

2) The spatial accuracy of features within a tile is not infinite. Mapbox vector tiles default to a spatial resolution of 4096 by 4096, so once you over-zoom a tile by say 5 levels (that is, show a tile that was generated for zoom 10 at zoom 15), you're down to a spatial resolution of just 4096 / (2 ^ 5) = 128, displayed at a web resolution of probably 256 pixels - which is noticeable.

Generating vector tiles is all about compromises (bytesize vs visual quality), so you may be able to get away with overzooming for your specific application.

5

No, you don't need separate vector files for each zoom level. Of course they could speed things a little bit up but will also require much more storage space than using a single database for a specific area.

However do note that PBF files are not suited for on-demand rendering. They are designed for efficiently storing OSM data, not for running queries on it. You should import them into a spatial database or use one of the already existing file formats used by other vector renders or develop your own file format. Otherwise your renderer will suffer from poor performance.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.