use of org.locationtech.spatial4j.shape.jts.JtsShapeFactory in project janusgraph by JanusGraph.
the class GeoshapeHelperTest method setUp.
@BeforeEach
public void setUp() {
this.helper = new JtsGeoshapeHelper();
this.factory = new JtsShapeFactory(helper.context, helper.factory);
}
use of org.locationtech.spatial4j.shape.jts.JtsShapeFactory in project traccar by tananaev.
the class GeofencePolygon method calculateArea.
@Override
public double calculateArea() {
JtsShapeFactory jtsShapeFactory = new JtsSpatialContextFactory().newSpatialContext().getShapeFactory();
ShapeFactory.PolygonBuilder polygonBuilder = jtsShapeFactory.polygon();
for (Coordinate coordinate : coordinates) {
polygonBuilder.pointXY(coordinate.getLon(), coordinate.getLat());
}
return polygonBuilder.build().getArea(SpatialContext.GEO) * DEG_TO_KM * DEG_TO_KM;
}
Aggregations