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

TileLayer API audit #4246

Merged
merged 2 commits into from
Feb 20, 2020
Merged

TileLayer API audit #4246

merged 2 commits into from
Feb 20, 2020

Conversation

Pessimistress
Copy link
Collaborator

For #4230
Follow up of #4139 and #4232

@ilan-gold

Change List

  • Rename strategy to refinementStrategy, add a mode never
  • Add maxCacheByteSize prop, resize cache based on byte size if supplied
  • Add Tileset prop
  • Remove getTileIndices, tileToBoundingBox; subclass Tileset2D by overriding the getTileIndices and getTileMetadata methods instead
  • Export Tileset2D class, documentation

@coveralls
Copy link

coveralls commented Feb 6, 2020

Coverage Status

Coverage decreased (-2.6%) to 80.781% when pulling 187d2b3 on x/tile-layer-generalize into 3659358 on master.

Copy link
Collaborator

@ibgreen ibgreen left a comment

Choose a reason for hiding this comment

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

This looks great. Sorry it took a while to review.

Renders one or an array of Layer instances with all the `TileLayer` props and the following props:

* `id`: An unique id for this sublayer
* `data`: Resolved from `getTileData`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Not something that bothers me, just calling out (and I think you already know) that in 3d tiles, the naming is "reversed":

  • data is called tile (aka tile content)
  • tile is called tile header

I personally think the 3d tiles naming ultimately is less confusing as various tile loaders return the actual "tile".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We cannot make a breaking API change in 8.x.

docs/layers/tile-layer.md Outdated Show resolved Hide resolved
docs/layers/tile-layer.md Outdated Show resolved Hide resolved

## Tileset2D

> This section describes advanced customization of the TileLayer.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe some simpler usage exposition of the non-subclassed Tileset2D class before jumping into the advanced customization case?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Going off that, is there a strong argument against baking this into deck.gl in some way? Using the non-geospatial coordinate system is something deck.gl supports but this layer as it stands is married to geo-spatial coordinates (and specifically does not have to be). Also, is there a difference between getTileIndicesInViewport and getTileIndices?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It should be just getTileIndices.

I can try integrating the non-geospatial handling. My main concern is that we don’t really have any test case for this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you mean unit testing or some sort of visual testing? I could create an image pyramid for this if you'd like. I'd also be happy to write unit tests.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That would be great! I'll add some unit tests before landing, but a sample set of tiles would be very helpful.

docs/layers/tile-layer.md Outdated Show resolved Hide resolved
docs/layers/tile-layer.md Outdated Show resolved Hide resolved
docs/layers/tile-layer.md Outdated Show resolved Hide resolved

##### `updateTileStates`

`updateTileStates()`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: For the next release; I think this API (my understanding it requires calling getTileIndicesInViewport/updateTiles/selectedTiles) is a bit cumbersome.

Also to support multi-viewport scenarios without thrashing I believe both this class and the Tileset3D should be able to accept a list of viewports when selecting tiles to be loaded and then return a list of tiles per viewport.

@@ -1,10 +1,11 @@
import {log} from '@deck.gl/core';

export default class Tile2DHeader {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here it is called header, not tile, so maybe a reason to align naming above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Cannot make a breaking change in 8.x.


const defaultProps = {
renderSubLayers: {type: 'function', value: props => new GeoJsonLayer(props), compare: false},
getTileData: {type: 'function', value: ({x, y, z}) => null, compare: false},
tileToBoundingBox: {type: 'function', value: defaultTile2Bbox, compare: false},
getTileIndices: {type: 'function', value: defaultGetIndices, compare: false},
Tileset: Tileset2D,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Don't we want to we accept a tileset instance, rather than a constructor? That seems a bit limiting?

Of course if none is provided we instantiate Tileset2D

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removing for now, will re-visit when Tileset2D is moved to loaders.gl.

@Pessimistress Pessimistress merged commit e6ce2ea into master Feb 20, 2020
@Pessimistress Pessimistress deleted the x/tile-layer-generalize branch February 20, 2020 22:47
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.

None yet

4 participants