0

I am visualizing movements on a map and want to set the zoom level dependent on the span of the polylines which visualize the movement. I already found an answer how to do this for markers, but I can't figure out how to get the span of the visualized data.

Ramona
  • 335
  • 1
  • 5
  • 18

1 Answers1

0

I found a way to use the solution mentioned above by including all movements to the LatLngBounds. Maybe not the most elegant solution but it works.

Builder latLngBoundsBuilder = new Builder();
for (int i = 0; i < movements.size(); i++) {
  latLngBoundsBuilder.include(movements.get(i).getPosition());
}
LatLngBounds latLngBounds = latLngBoundsBuilder.build();
Ramona
  • 335
  • 1
  • 5
  • 18