I'm developing an application to Android and I need to add markers every 1000meters² inside a Polygon.
public class MapsActivity extends FragmentActivity {
private GoogleMap mMap;
private Polygon poly;
private boolean isMarked;
public void btClick(){
if(isMarked){
//Add markers inside polygon here
}
}
...
}
I need it to be equally spaced. I mean, inside this polygon i need to insert a marker every 1000meters.. Like a grid..
Something like this... each "." is a marker that i inserted
I found something like that.. m50 is 50meters..
double add = (m50*20)*distHa;
for(double a=menLat; a<=maiLat; a+=add){
for(double b=menLng; b<=maiLng; b+=add){
try {
Marker marked = mMap.addMarker(new MarkerOptions()
.position(new LatLng(a, b)
)
);
markers.add(marked);
}catch (Exception e){
Log.d("erro", e.toString());
}
}
}
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.