geometry-api-java
geometry-api-java copied to clipboard
PolygonUtils not in Jar
I need to use PolygonUtils but it's not in the released Jar.. how can i use it?..thank you.
Hi, which methods do you want to use?
I want to use functions for geofencing, PolygonUtils.isPointInPolygon2D()
Will OperatorDisjoint work for you? Here is an example of how to use it.
Point point = new Point(1, 1);
Polygon polygon = new Polygon();
polygon.startPath(0, 0);
polygon.lineTo(0, 3);
polygon.lineTo(3, 3);
polygon.lineTo(3, 0);
SpatialReference spatialRef = SpatialReference.create(4326);
// Returns false in this case meaning that the point is in the polygon
boolean disjoint = OperatorDisjoint.local().execute(point, polygon, spatialRef, null);
Yes, this works for me, thank you. but is it the best and fastest way? because i'm working on bigdata use case... will PolygonUtils be faster?
@SiefSeif Use OperatorDisjoint. Avoid creating objects in a loop, you could also move OperatorDisjoint.local() call outside of the loop. The spatial reference is used to extract a tolerance value of about 1 mm and is used close to polygon borders, you can pass null spatial reference if you don't care about the tolerance.