Hide Buildings by area

Hello everyone!

Im currently evalutating CesiumJS as a solution for a customer.

I have the following use case:

A user draws a building using simple geometric shapes (like rectangles) in a different 2d mapping technology (leaflet).
The newly drawn building is intended to overwrite the existing buildings that come from OSMBuildings and whose footprints intersect the new building. I have all Lat/Long corners of the newly drawn shape at the ready.
I tried doing that using the Cesium-Style-Language, but it seems like i only have access to the OSM-Buildings centres.

Is there any way to make this work? Is there maybe a function in CesiumJS that i could use to get all building-ids in an area, so i can just hide those?

Thanks for your help in advance!

Hi there,

It may depend on what metadata is included in your 3D tileset, but think the best way to do this would be to set the show property of each feature (in this case a building) based on the position. You’ll probably want to use an additional library or module that implements a “point in polygon” algorithm.

Here’s an example of how you set the a property of each feature on the tile load event.