Geographic Information Systems Asked by hxd1011 on August 8, 2021
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?
http://PBFSERVER/13/2411/3080.pbf
Update:
I am trying to follow the tutorial here, code hereso can I say the CRS is 26918?
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,
SELECT
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.
Correct answer by Francisco Puga on August 8, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP