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

advice: masking an image using a geojson polygon #227

Open
joprice opened this issue Jan 31, 2025 · 1 comment
Open

advice: masking an image using a geojson polygon #227

joprice opened this issue Jan 31, 2025 · 1 comment

Comments

@joprice
Copy link

joprice commented Jan 31, 2025

I'm having a bit of trouble wrapping my head around an approach to mask an image over the bounding box of a geojson object, where the image would be rendered only where the geojson polygon is defined. I started by using polygonCapMaterial, which looks great, but since my objects are MultiPolygon, they end up repeating the image instead of displaying a uniform image. II'm currently toying with customThreeObject, but the object ends up not hugging the surface of the globe by default, which I'm not yet sure how to accomplish. I also considered an approach where I use globe.gl to "pre-bake" the image, then add it as another layer, then set the opacity or clipping somehow, but also not sure how that would play out. Is there any goto approach for accomplishing this?

@vasturiano
Copy link
Owner

@joprice thanks for reaching out.

The way MultiPolygon objects are handled is that the same exact materials are applied to all the individual polygons in the group. There's currently no means to specify different materials for each sub-polygon.

What I would recommend to go around this is to transform your input data so that the various MultiPolygon items are converted to individual Polygon at the top level of your geojson. That way you'll be able to specify individual materials for each.

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

No branches or pull requests

2 participants