Add possibility to convert tiles to other coordinates than WGS84#34
Add possibility to convert tiles to other coordinates than WGS84#34charlenni wants to merge 12 commits intoNetTopologySuite:developfrom
Conversation
|
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? |
…t they could be used from outside
There was a problem hiding this comment.
Why did you choose to add an interface over making TileGeometryTransform a public class that can be derived from?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
@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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
What is the use-case for this transformation?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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.