Geographic Information Systems Asked by andzaOs on April 30, 2021
Is there any function/library that I can use to create a non-intersecting polygon?
Below is the code that I used to draw Polygon from the specified points but it is not working for the non-intersecting part.
public drawPolygon(points: LonLat[]): Feature {
let coordinates = [];
points.forEach(function (point) {
coordinates.push(fromLonLat([point.lon, point.lat]))
});
let feature = new Feature(new Polygon([coordinates]));
return feature;
}
This was a solution for my problem:
public drawPolygon(points: LonLat[]): Feature {
let coordinates : Coordinate[] = [];
points.forEach(function (point) {
coordinates.push(fromLonLat([point.lon, point.lat]))
});
let convexHullCoordinates = this.convexHull(coordinates);
let feature = new Feature(new Polygon([convexHullCoordinates]));
return feature;
}
Correct answer by andzaOs on April 30, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP