Skip to content

PolygonUtils not in Jar #147

Open
Open

Description

@SiefSeif

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

Activity

  1. alocke commented on Oct 16, 2017

    @alocke
    Member

    Hi, which methods do you want to use?

  2. SiefSeif commented on Oct 17, 2017

    @SiefSeif
    Author

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

  3. alocke commented on Oct 17, 2017

    @alocke
    Member

    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);
    
  4. SiefSeif commented on Oct 18, 2017

    @SiefSeif
    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?

  5. stolstov commented on Oct 18, 2017

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions