Skip to content

Conversation

@charlenni
Copy link

Hello,

I try to give back something to this wonderful project. Thank you for it.

I encountered the problem described in #27 by myself. I like to have the VectorTile in coordinates of the range 0..511 and not in WGS84. So I tried to add this functionality. With this PR it is possible to add a parameter for a function, that creates the TileGeometryTransformer when creating the reader or writer of the Mapbox tile source.

@CLAassistant
Copy link

CLAassistant commented Mar 31, 2025

CLA assistant check
All committers have signed the CLA.

@memsom
Copy link

memsom commented Apr 2, 2025

I have also hit the same problem looking at a similar issue as @charlenni for a different use case in the same project. I was rendering pure Vector tiles and needed the points to be translated to the world rather than WGS84. Is there are possibility this PR might be able to be reviewed? @xivk or @FObermaier are you able to progress this at all?

Copy link
Member

@FObermaier FObermaier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you choose to add an interface over making TileGeometryTransform a public class that can be derived from?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. That would be another viable way to do this. Would you prefer, that I write it in this way? Should be possible without problems.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if a class is the better approach. How much of it could be reused? @memsom could you set up a Transform for an arbitrary spatial reference system based on this PR?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FObermaier I haven't had time to dig in to the PR, but I believe this PR in general would help my use case. I don;t have a preference interface vs class, I mostly need to be able to plot the tiles in the co-ordinates system being used by the mapping engine's world view, and getting there directly without my current hack would help a lot.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's go one step back. All Mapbox vector tile coordinates are in the 4096x4096 raster. The tile has a size of 512x512. The NTS reader converts this coordinates to WGS84 (with negative y axis). It would be nice to have a function, that read the vector tiles data in its native coordinate system or can convert this coordinates in any coordinate system. For that you need a converter. This is the reason for this PR.

I hope, that explains the background. I fear, no one was looking in this part of the code since it was created.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the use-case for this transformation?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally Mapbox vector tiles have a internal size of 4096 (positions going from 0 to 4095). The tile size is 512. So to draw a tile, you have to convert all points by dividing them by 8. Then you could draw a tile with size of 512x512.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see what Relative has to do with that. As the math for both don't look too complex, can we just merge the two transforms into one?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have always problems with good names. Relative, because you could transform from 4096 to 512, what I use, or you could transform from 512 to 256. Or anything else.

It would be possible to provide a function, that transform the extracted coordinates to the geometry coordinates. Need the coordinates for 0/0 and width/height of tile and returns coordinates.

Btw. when I saw it correct, then the current implementation returns negative coordinates in y direction.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relative, because there is no absolute corner to which the coordinates are calculated.

For me it was unclear, why there is such a function when it isn't replaceable with something else. And normal behavior for a Mapbox reader is to transform from 4096x4096 coordinates to 512x512 ones. Transfering them from 4096x4096 to WGS84 is for me more unusual.

So I thought about a way to replace this function. And most of the functions for this class have to be changed when you replace it. So I decided to create an interface for this. But I have to say, that I need only the reader part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants