[英]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 )我需要向谷歌 map 应用程序添加 290 个多边形,它不能是一个 kml 文件,因为我需要使用多边形的一些属性(主要是为了知道一个点是否在多边形内)
i got the coordinates in a excel sheet where each row has about 40 pairs of coordinates.我在一张 excel 表中得到了坐标,其中每一行都有大约 40 对坐标。 Anyone know any way?任何人都知道任何方式?
I know this shape, but since there are 290 polygons and many coordinates, I am looking for alternatives.我知道这个形状,但由于有 290 个多边形和许多坐标,我正在寻找替代方案。
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));
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.