I am trying to learn the Vector Tile Map, and got one pbf file for one tile. I can load it into QGIS, but how can I know the CRS?



I am trying to follow the tutorial here, code hereso can I say the CRS is 26918?

1 Answer 1


The (mapbox) vector tile specification states that:

A Vector Tile represents data based on a square extent within a projection. A Vector Tile SHOULD NOT contain information about its bounds and projection. The file format assumes that the decoder knows the bounds and projection of a Vector Tile before decoding it.

So if there is no vendor specific information included in the file there is no way to know which is the CRS.

But it can be safely assumed for most cases, that the EPSG identifier is EPSG:3857 as the specs also say:

Web Mercator is the projection of reference, and the Google tile scheme is the tile extent convention of reference

In the example you provide, look at this line,

    ST_AsMVTGeom(ST_Transform(t.{geomColumn}, 3857), bounds.b2d) AS geom
    , {attrColumns}
FROM {table} t, bounds
WHERE ST_Intersects(t.{geomColumn}, ST_Transform(bounds.geom, {srid}))

the original geometry is transformed to 3857, and all the transformations between the xyz scheme to the tile bounds/envelope is done assuming the web mercator projection (aka, spherical mercator or EPSG:3857).

Also note that some of the python code in that example is no needed for the next PostGIS version as the new function ST_TileEnvelope can make the transformation from xyz to an envelope. If that function can not be used and you want to work with other projections the python mercantile library can be used, instead of making your own calculations.

As a side note, remember that PBF (Google Protobufs) is the format used to encode/serialize vector tiles, but .pbf does not have to know about its content. Or sayed in another way: Vector Tiles are encoded as .pbf (usually using the extensions .mvt instead of .pbf to make it clear). But a .pbf does not have to contain data in the (MapBox) Vector Tile Specification.

  • thank you for the help!, I updated the question. If MVT does not contain CRS, how can I calculate it from the link I updated ?
    – hxd1011
    Sep 9, 2019 at 11:29
  • Most tile services use EPSG:3857.
    – user30184
    Sep 9, 2019 at 11:58
  • i update the answer, i should provide the common case from the beggining Sep 9, 2019 at 12:10
  • Great answer ! Thanks for your time to read additional links. This really helps. @FranciscoPuga
    – hxd1011
    Sep 12, 2019 at 18:50

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.