Wrong coordinates on MVTLayer
See original GitHub issueDescription
Bellow I have two screenshots and you can see what coordinates I get from MVTLayer (the black one) which are wrong. On the white background are the correct ones from the TileLayer with some code I used in getTileData
.
I assume that the issue is somewhere in the calculations happening inside the MVTLayer’s renderSubLayers
.
renderSubLayers(props) {
const {tile} = props;
const worldScale = Math.pow(2, tile.z);
const xScale = WORLD_SIZE / worldScale;
const yScale = -xScale;
const xOffset = (WORLD_SIZE * tile.x) / worldScale;
const yOffset = WORLD_SIZE * (1 - tile.y / worldScale);
const modelMatrix = new Matrix4().scale([xScale, yScale, 1]);
props.autoHighlight = false;
props.modelMatrix = modelMatrix;
props.coordinateOrigin = [xOffset, yOffset, 0];
props.coordinateSystem = COORDINATE_SYSTEM.CARTESIAN;
props.extensions = [...(props.extensions || []), new ClipExtension()];
return super.renderSubLayers(props);
}
Repro Steps
Check the object
in the onHover/onClick events
Environment
- Framework Version: deck.gl 8.2.5
- Browser Version: Chrome 84.0
- OS: Mac OS X 10.15
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Top Results From Across the Web
Coordinate Systems - deck.gl
It is the default coordinate system when rendering into non-geospatial views. When combined with geospatial views, the positions are treated as common space ......
Read more >Can't reference an MVT layer from Mapfile - GIS Stack Exchange
I'm trying to add an MVT layer to my Mapfile, but it doesn't work and I ... [Thu Dec 30 12:17:43 2021].133000 msOGRFileOpen():...
Read more >MVTLayer | XYZ Maps Documentation
The error message of the failing request. name: "NetworkError". The name property represents a name for the type of error. The value is ......
Read more >mvt_layer: MVT Layer in anthonynorth/rdeck: Deck.gl Widget
< "XY" | "XYZ" > Determines whether each coordinate has two (XY) or three (XYZ) ... < boolean > If TRUE , circles...
Read more >How can I get onHover to work for deck.gl MVTLayer?
What am I doing wrong? Strawson on Free Will: What are the most persuasive challenges to his position? Do I deserve to be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Overriding the
loadOptions
in MVTLayer will not fix your problem, as the defaultrenderSubLayers
expect Cartesian coordinates.In your
pickingInfo
there should also be atile
object that contains the bounding box of the tile. The feature coordinates are normalized to 0-1 inside this bounding box. You can find the lnglat like this:Thanks so much @Pessimistress for clarifying, that makes so much sense. Cheers.