Output cartesian coordinates instead of lon/lat #70
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I’m trying to use CARTESIAN coordinate system with Deck.gl, and that’s why I am modifying this code to return unprojected coordinates in
toUnprojectedJSON
as a test.So, to provide some context, in our MVTTileLayer PR, they suggested us to use CARTESIAN coordinate system to avoid projecting and unprojecting points, and use common space positions when rendering our layer.
To support that, they made a PR to support pre-projected positions in Deck.gl which is this one: visgl/deck.gl#4140.
So, taking into account those changes, I am changing the code to get MVT points without converting coordinates into WGS84, and get those X, Y points from coordinates’ origin.
I modified
loadGeometry
method and created another one namedgetFlatGeometryAndHoles
which returns geometry points from (0,0) taking into account tile index as you can see here:https://github.com/mapbox/vector-tile-js/pull/70/files#diff-eb2dc36e72f5c177fb8b5df20dc67768R77-R78
I made a little test with Deck.gl PolygonLayer and it’s not working as expected.
I tried without updating Deck.gl with the latest changes first (because I forgot to update), and the polygons were kinda there but much closer to null island than where they should be.
After updating, I see no geometries.
So there’s something that I’m definitely missing. This PR is very WIP, so try not to be bothered by method names.
Researching a bit more on the library, it uses this function to project the points: https://github.com/CartoDB/vector-tile-js/blob/master/lib/vectortilefeature.js#L137-L145. And it sums the points with the tile coordinate origin.
I guess that I’m not getting that common space positions right :(