Reputation: 137
How can one create a Polygon buffer, let's say 20 m around a specific point?
I am using the flutter_map package. Is there anyone who's got any ideas on how to implement this?
Upvotes: 0
Views: 633
Reputation: 137
So there's this package called dart_jts pub.dev which is a port of the Java Topology Suite, which can do exactly this. The issue I have is how to specify the distance in metres or kilometres.
import 'package:dart_jts/dart_jts.dart' show GeometryFactory,Coordinate,Polygon,BufferOp;
final geometryFactory = GeometryFactory.defaultPrecision();
final point = geometryFactory.createPoint(
Coordinate(
longitude,
latitude,
),
);
final distance = 0.0002;
// final buffer = point.buffer(distance);
final buffer = BufferOp.bufferOp3(point, distance, 6);
return buffer as Polygon;
Upvotes: 0