Fix isInside for multipolygons which are marked as polygon

This commit is contained in:
pietervdvn 2021-06-24 13:50:35 +02:00
parent 651d987386
commit 45bf08744f

View file

@ -151,10 +151,10 @@ export class GeoOperations {
const x: number = pointCoordinate[0]; const x: number = pointCoordinate[0];
const y: number = pointCoordinate[1]; const y: number = pointCoordinate[1];
for (let i = 0; i < feature.geometry.coordinates.length; i++) {
let poly = feature.geometry.coordinates[i];
let poly = feature.geometry.coordinates[0]; let inside = false;
var inside = false;
for (let i = 0, j = poly.length - 1; i < poly.length; j = i++) { for (let i = 0, j = poly.length - 1; i < poly.length; j = i++) {
const coori = poly[i]; const coori = poly[i];
const coorj = poly[j]; const coorj = poly[j];
@ -170,8 +170,12 @@ export class GeoOperations {
inside = !inside; inside = !inside;
} }
} }
if (inside) {
return true;
}
}
return inside; return false;
}; };
static lengthInMeters(feature: any) { static lengthInMeters(feature: any) {