-
-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Is there currently any way to clip or inspect a <Raster />
component's data to a custom extent other than that of the <RegionPicker />
? I am currently working on a project where I want to inspect the raster data within a given country, state, or other custom vector boundary. However, I was not sure of the best way to do this without creating additional raster layers aggregated at the state or national levels. I wrote a related, but more specific GitHub issue for a project that I am working on about excluding data from the <RegionPicker />
, but I thought that a more general use case might be of interest to others here.
Note: I recognize that clipping data usually involves masking out data and reducing spatial extent, which currently is not possible given the data requirements for using the maps
package. What I actually want is more in line with the current behavior of the <RegionPicker />
, but with custom boundaries. With that in mind, here is what I have come up with so far.
I think you would need to completely rewrite the a local version of the <RegionPicker />
. First, you could turn each vector layer into a Turf.js multipolygon object when it is loaded onto the map, instead of using a Turf.js circle in the <CircleRenderer />
, which is the current default. These multipolygon geometries would then need to be fed dynamically to the <RegionPicker />
as a user interacts with them via a dropdown menu, on hover, etc. I admit, this would be a heavy lift since the logic of the <CircleRenderer />
seems embedded in many other parts of the code, namely in the queryRegion()
method of the <Tile />
component.
For only a small subset of vector layers (countries, states), creating additional raster layers seems like the way to go. But if a user would want to inspect the data within several, custom vector layers, does this sound like the approach you would have to take? Or is there an easier method that I am not thinking of?