Consider an array1 of n no. of features
array1=[feat1,feat2,...,featn]
and array2 of m no. of linearRings
array2=[ring1,ring2,...,ringm]
.
Now write a program in javascript such that every element of array2
is compared with every element of array1
.
PS: please suggest an approach apart from nested for loop.
The approach I tried:
features.map(feature => {
linearRings.map(linearRing => {
const singleFeature = getTurfFeature(feature);
const pointOfLinearRing = point(
transform(linearRing.getFirstCoordinate(), 'EPSG:3857', 'EPSG:4326')
);
const checkForOverlap = booleanIntersects(pointOfLinearRing, singleFeature);
checkForOverlap && feature.getGeometry().appendLinearRing(linearRing);
});
});