-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Reproject DataTiles #13654
Reproject DataTiles #13654
Conversation
|
📦 Preview the examples and docs from this branch here: https://deploy-preview-13654--ol-site.netlify.app/. |
7ca8c06
to
114d0b8
Compare
d07e5cf
to
121a34b
Compare
8ca64e1
to
4d18106
Compare
d9b3dab
to
b693892
Compare
eb8b318
to
ef153d2
Compare
db1048a
to
c67ef84
Compare
3393b95
to
3254aaf
Compare
aba597a
to
50788c7
Compare
Use ReprojDataTile Use tilePixelRatio in reprojection to preserve data where DataTile source tileSize exceeds TileGrid tileSize Add getReprojectCapability() method
discard blended and empty pixels
dd57c7f
to
557e47a
Compare
| releaseCanvas(ctx2); | ||
| canvasPool.push(ctx2.canvas); | ||
| return data[0] === 0 || data[0] === 255; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a function that we necessarily need or want to maintain in the API (better at the application level). So I've pushed a commit that removes it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem with that. I now have a workaround which reduces an image (by removing rows or columns) so it does not need to be downscaled but that is perhaps best left as a follow-up PR?
| const key = this.getKey(); | ||
| if (tile && tile.key == key) { | ||
| return tile; | ||
| } else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, but we can have less indentation on the happy path if we avoid these return-else. I've pushed a commit that reworks these and will add a linter rule separately.
| * @protected | ||
| * @type {!Object<string, import("../tilegrid/TileGrid.js").default>} | ||
| */ | ||
| this.tileGridForProjection = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can be private. I've pushed a commit that changes this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your efforts on this, @mike-000. I know this will be appreciated new functionality in the library.
Fixes #13197
Allows reprojection of multiband and raw values GeoTIFF and DataTile sources by reprojecting 3 bytes per pixel in sequence via raster reprojection until all bytes per pixel have been reprojected, then combining the result in a new DataTile. A
ReprojDataTileclass avoids the need for intermediate sources.https://deploy-preview-13654--ol-site.netlify.app/en/latest/examples/geotiff-reprojection.html
To handle non-parallel projections data for areas outside the source tile grid but inside reprojected tiles with partial coverage of the source grid is returned as zeros, so sources should be configured to include alpha. Tiles in the reprojection tile grid which are entirely outside the source tile grid have an
EMPTYstate which is handled by the renderer.Sources are expected to have the same band count and data type at each zoom level.
A second (and more realistic use case scenario) example is added - displaying two adjacent Sentinel COGs which are in different projections due to being in different UTM zones.
https://deploy-preview-13654--ol-site.netlify.app/en/latest/examples/multiple-cogs.html
Added a static method to determine browser accuracy:
https://deploy-preview-13654--ol-site.netlify.app/en/latest/apidoc/module-ol_source_datatile#.getReprojectCapability
Gecko browsers which might interpolate a reprojection canvas even if
imageSmoothingEnabledis false currently account for around 3.2% of browser use https://gs.statcounter.com/browser-market-share#monthly-201708-202208