question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Way of dynamically desaturate part of image TileLayer

See original GitHub issue

When using TileLayer, we could desaturate a tile by setting desaturate props of BitmapLayer returned from TileLayer.renderSubLayers, which is quite handy.

Now, we want to achieve effect that dynamically desaturating some rectangle part of a tilelayer: On top of an image TileLayer, there are rectangle grids specified by PolygonLayer. Depending on data, some grids are shown in greyscale while others are shown as original. The desaturate props works at tile level, how do we have similar effect at this grid level?

  • Need we do some manual modification upon image when constructing BitmapLayer? Or
  • we could have some blend function in extended PolygonLayer or BitmapLayer to achieve the target? Or
  • maybe Mask RFC #4161 could help?

Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
Pessimistresscommented, Oct 16, 2020

You can also subclass the BitmapLayer to apply color filter inside a custom boundary. See https://observablehq.com/@pessimistress/deck-gl-shader-injection

1reaction
kylebarroncommented, May 25, 2020

I think you could do this in a relatively straightforward manner if that polygon coincides with a tile.

const { bbox } = props.tile;
if (!bbox intersects Polygon) {
	desaturate
}

And use Turf.js for the intersection. The problem is that desaturates entire tiles at once. I don’t think there’s currently a way to desaturate portions of the image without creating a custom LayerExtension

Read more comments on GitHub >

github_iconTop Results From Across the Web

Imagery layers, tile caches, and map image layers—ArcGIS ...
Map image layers can be dynamically displayed over basemaps that use a different coordinate system. For map image layers displayed as cached image...
Read more >
Desaturate a specific area of an image - Pixelmator Pro
The Desaturate tool is used to make the colors in a specific area of an image less vivid and vibrant. Using this tool,...
Read more >
WebMapTileServiceImageryProv...
Examples: // Example 1. USGS shaded relief tiles (KVP) const shadedRelief1 = new Cesium.WebMapTileServiceImageryProvider({ url ...
Read more >
The 4th Dimension – Creating Dynamic Animated Tile Layers ...
To change the properties of an existing tile layer, you use the setOptions() method of the tile layer, passing in the same TileLayerOptions ......
Read more >
Desaturate Selected Parts of an Image in Photoshop ...
In this tutorial you will learn how to use the adjustment layers and masks to selectively desaturate parts of your image in Adobe...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found