Kuriel Kuriel - 1 year ago 106
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 Source

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


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

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