Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PolygonUtils not in Jar #147

Open
SiefSeif opened this issue Oct 15, 2017 · 5 comments
Open

PolygonUtils not in Jar #147

SiefSeif opened this issue Oct 15, 2017 · 5 comments

Comments

@SiefSeif
Copy link

SiefSeif commented Oct 15, 2017

I need to use PolygonUtils but it's not in the released Jar.. how can i use it?..thank you.

@alocke
Copy link
Member

alocke commented Oct 16, 2017

Hi, which methods do you want to use?

@SiefSeif
Copy link
Author

I want to use functions for geofencing, PolygonUtils.isPointInPolygon2D()

@alocke
Copy link
Member

alocke commented Oct 17, 2017

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);

@SiefSeif
Copy link
Author

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?

@stolstov
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants