After difference()
implementation for my polygon map, I find out, that when I zoom in map some unexpected shapes appear or disappear which shouldn't be there. There are MultyPolygon
and Polygon
type polygons and I compare them and even checking the length of polygon coordinates, but that didn't help.
let previousFeature = {}
let x
for(x = 0;x < second_features.length; x++){
if (x === 0) {
previousFeature = second_features[x]
} else {
if (previousFeature.geometry.coordinates.length ===
second_features[x].geometry.coordinates.length)
{
second_features[x - 1] = difference(previousFeature.geometry, second_features[x].geometry)
}
second_features[x - 1].properties.time_distance = previousFeature.properties.time_distance
second_features[x - 1].properties.gid = previousFeature.properties.gid
previousFeature = second_features[x]
}
Unexpected shape appears which crosses through polygons while doing zoom in and zoom out.