简体   繁体   中英

How to add a lot of polygon to a google map app in android studio without using kml

i need to add 290 polygons to a google map app, and it cant be a kml file because i need to use some properties of the polygons ( mainly to know if a point is inside a polygon )

i got the coordinates in a excel sheet where each row has about 40 pairs of coordinates. Anyone know any way?

I know this shape, but since there are 290 polygons and many coordinates, I am looking for alternatives.

Polygon polygon1 = googleMap.addPolygon(new PolygonOptions()
    .clickable(true)
    .add(
            new LatLng(-27.457, 153.040),
            new LatLng(-33.852, 151.211),
            new LatLng(-37.813, 144.962),
            new LatLng(-34.928, 138.599)));

How about using loop?

@Override
public void onMarkerDrag(Marker marker) {

//add the marker's latlng in a arraylist of LatLng and pass it to the loop
for (int i = 0; i < arraylistoflatlng.size(); i++) {
     myMap.addPolyline(new PolylineOptions()
    .addAll(arraylistoflatlng)
    .width(5)
    .color(Color.RED));
}
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM