Kuriel Kuriel - 2 months ago 22
Java Question

android-maps-utils for Java?

is there something like http://googlemaps.github.io/android-maps-utils/ (for Android) but for Java?

in specific we need to implement the containsLocation method from http://googlemaps.github.io/android-maps-utils/javadoc/com/google/maps/android/PolyUtil.html#containsLocation-LatLng-java.util.List-boolean-

but for JavaWeb

Answer

Yes. I successfully used the following library on web applications.

https://github.com/sromku/polygon-contains-point

Polygon polygon = Polygon.Builder()
    .addVertex(new Point(1, 3))
    .addVertex(new Point(2, 8))
    .addVertex(new Point(5, 4))
    .addVertex(new Point(5, 9))
    .addVertex(new Point(7, 5))
    .addVertex(new Point(6, 1))
    .addVertex(new Point(3, 1))
    .build();

Point point = new Point(4.5f, 7);
boolean contains = polygon.contains(point);
Comments