Open antoniocarlon opened 5 years ago
I've just done a very quick review, and I think the VL function is the correct one:
Comparing both coordinate systems:
0,0 |1 1,0
|
|
-1 -------+------- 1
|
|
0,1 -1| 1,1
Will result into:
0, 0 => -1, 1
1, 0 => 1, 1
0, 1 => -1, -1
1, 1 => 1, -1
We've been using CARTO-VL to draw geometries on a map using our own MVT server and it seems that the current implementation takes the bottom-left corner of the tile as the origin of the tile.
In particular, we've been diving into this function that transforms the tile's coordinates space (0 to 4096 for example) to a new coordinates space from -1 to 1: https://github.com/CartoDB/carto-vl/blob/c374e0ed80183e12353fdf5808b4031a4bf99dc8/src/client/mvt/feature-decoder.js#L189-L199
It seems that this function is inverting the
y
coordinate, making the bottom edge of the tile the origin of they
axis. We have written a quick Python test to prove our point:Taking a look at the Mapbox Vector Tile Specification, it seems that from version 2.0, Geometry data in a Vector Tile is defined in a screen coordinate system. The upper left corner of the tile (as displayed by default) is the origin of the coordinate system. The X axis is positive to the right, and the Y axis is positive downward. (https://github.com/mapbox/vector-tile-spec/tree/master/2.0). We haven't found anything similar for versions 1.0.0 and 1.0.1.
Is it a bug or is this the intended behavior and we need to fix it in our server?
cc @VictorVelarde @juanignaciosl