Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] MVTLayer Cartesian Coordinates #9355

Open
s-n-i opened this issue Jan 15, 2025 · 3 comments
Open

[Feat] MVTLayer Cartesian Coordinates #9355

s-n-i opened this issue Jan 15, 2025 · 3 comments
Labels

Comments

@s-n-i
Copy link

s-n-i commented Jan 15, 2025

Target Use Case

MVTLayer incorrectly visualizes a vector tile dataset in Cartesian coordinates in OrthographicView.

https://codepen.io/s-n-i/pen/KwPeapW

I would like to make MVTLayer compatible with this use case.

Proposal

Changing the modelMatrix like this results in correct visualization:

s-n-i@4cacc13

https://codepen.io/s-n-i/pen/ZYzRLYX

I was wondering if MVTLayer is already intended to support Cartesian coordinates because it appears to infer a Cartesian coordinate system from !this.context.viewport.resolution in the source code here. If Cartesian coordinates are already intended to be supported, I can change this issue to a bug ticket.

props.coordinateSystem = COORDINATE_SYSTEM.CARTESIAN;

@lasconic
Copy link

FWIW, I tried to make this change, but it doesn't compile... So there is probably some more changes to make.

src/mvt-layer/mvt-layer.ts:262:35 - error TS2339: Property 'left' does not exist on type 'TileBoundingBox'.
  Property 'left' does not exist on type 'GeoBoundingBox'.

262       .translate([props.tile.bbox.left, props.tile.bbox.top, 0])
                                      ~~~~

src/mvt-layer/mvt-layer.ts:262:57 - error TS2339: Property 'top' does not exist on type 'TileBoundingBox'.
  Property 'top' does not exist on type 'GeoBoundingBox'.

262       .translate([props.tile.bbox.left, props.tile.bbox.top, 0])
                                                            ~~~

src/mvt-layer/mvt-layer.ts:263:30 - error TS2339: Property 'bottom' does not exist on type 'TileBoundingBox'.
  Property 'bottom' does not exist on type 'GeoBoundingBox'.

263       .scale(props.tile.bbox.bottom - props.tile.bbox.top);
                                 ~~~~~~

src/mvt-layer/mvt-layer.ts:263:55 - error TS2339: Property 'top' does not exist on type 'TileBoundingBox'.
  Property 'top' does not exist on type 'GeoBoundingBox'.

263       .scale(props.tile.bbox.bottom - props.tile.bbox.top);

@s-n-i
Copy link
Author

s-n-i commented Jan 23, 2025

Thank you for the feedback. I added a type cast.

s-n-i@b73a814

Now npm run build works.

@lasconic
Copy link

Thanks! Now, I can display microjson, created with the microjson toolkit. Somehow, the scale is wrong but I'm not sure if it's due to MVTLayer or my application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants