-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[RFC] Make Tileset2D generic #6816
Comments
Great proposal, making Tileset2D more generic and customizable/replaceable has been a goal for a long time.
Finally, as a minor preference it would be nice to be able to pass an instance of a |
Good point regarding the link with
I will work on a PR that focuses on the 2D use case for now, basically implementing my proposal above. We can then revisit the question on whether it makes sense to move the class to loaders.gl |
Without necessarily wanting to influence your conclusions, let me just try to make sure you have a fair picture of the 3D tile system The idea with the tiles loader architecture in loaders.gl is that that the various tile loaders load into a normalized Tileset3D / Tile3D format defined by the
No, to the contrary, the Tile3DLayer shouldn't need to know anything about the details of e.g. 3D Tiles or I3S formats. In practice, over years of development, some small dependency might have accidentally crept in but if so it should be easily fixable and the basic architecture should still be clean and abstract. The idea here is of course that we should be able to add support for e.g. potree and COPC loader modules in loaders.gl without even changing a single line in the deck.gl Tile3DLayer. The normalized Tileset3D class has a generic traversal model that requests new tiles for a viewport, and I don't think it should be any problems to extend it to handle 2D. Getting up to speed on that code base may not be worth it but the downside is of course that we may end up with two parallel, partly overlapping, complex systems. |
Thanks for the diagram, that is useful. My point regarding the new Layer, which I badly named deck.gl/modules/geo-layers/src/tile-3d-layer/tile-3d-layer.js Lines 177 to 192 in 04ca468
I agree that it is a great goal to have loaders.gl be written such that new 3D tile formats can be added. However to allow other tiles with data formats to be added, e.g. bitmaps, quadkey/H3 data as JSON, |
Anyway, to get back to the original proposal, I had already got most of the way there with a draft PR on making Tileset2D generic. I've made a test app which implements loading for Quadkeys and H3 indices. In doing so I came across a few things which made me change my mind about the original proposal:
|
The two TileLayer examples under examples/website need to be updated to the new API (indices in the tooltip showing undefined). |
Hi @felixpalmer and @Pessimistress and @ibgreen , I used a custom If I set a breakpoint into Interestingly, even If I make my points in the |
@kopp I can't really say without seeing the code. Here is an example of a H3 based tile layer where picking is working: https://github.com/visgl/deck.gl/blob/master/modules/carto/src/layers/h3-tile-layer.ts |
Hi @felixpalmer thanks a lot for getting back to me about this and pointing out the example. My understanding is now, that you have to implement the |
Target Use Case
TileLayer
relies onTileset2D
and associated classes to implement the loading tiles, using the OSM tiling scheme. This is restrictive in that only allows tiling where the tiles have the same shape as those in OSM. TheTileset2D
is quite generic and with fairly minimal changes I've been able to build a PoC with usesH3
indices to define the tiles and use hexagonal tiles rather than square tiles.Screen.Recording.2022-04-11.at.17.17.50.mov
In a similar manner a whole host of different tiling schemes could be supported by the
TileLayer
.Proposal
New props & API
#5504 Expose Tileset2D instance already covered the first step, and this RFC assumes that it will be how the
Tileset2D
will be exposed to users ofTileLayer
.The following classes are made publicly available from the
geo-layers
module:Tileset2D
&Tile2DHeader
.Modifications to existing classes
TileHeader2D
is modified to be generic:index
property is added. This uniquely describes the tile and allows it to be constructed. For OSM this is{x, y, z}
.Tileset2D
is modified to better allow subclassing:index
of{x, y, z}
, useTileHeader2D
'sindex
getTileId
method is added for subclasses to implement for converting theindex
into a unique stringgetTileZoom
method is added for subclasses to implement for converting theindex
into a zoom levelgetURLFromTemplate
is enhanced to support arbitrary keys in theindex
object. E.g.{h3: '82488ffffffffff'}
Usage
With the above changes the typical pattern of creating a new tiling scheme would consist of defining a new header and overriding the public API of
Tileset2D
to specify how to work with the tiles. The choice of the key name in the index matched the key(s) used for interpolation in the URL:Finally to use the custom
Tileset2D
with theTileLayer
, thegetURLFromTemplate
method needs to be implemented to specify how to load the data:Discussion
Tileset2D
be exposed as an abstract class andOSMTileset2D
be provided as the default implementation toTileLayer
?zoom
a good name?resolution
may be more appropriate, but would mean changing the APIThe text was updated successfully, but these errors were encountered: