I wrote some code for removal of polygon holes whose area value is under the hardcoded threshold.
source_g.getFeatures()[0].getGeometry().getPolygons().forEach(function(poly){
if(!(poly.getLinearRings().length<=1))
{
poly.getLinearRings().forEach(function(ring){
if(Math.abs(ring.getArea()) < 0.1){
ring.setCoordinates([])
}
})
};
})
The idea is to set coordinates of inner LinearRings
to []
, I tried to do that on the whole feature and it disappeared. But for LinearRings
it's not doing the same.