NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

My map will have two markers for routing purpose, now how could i automatically zoom out to the center between those two markers? Is there any alternative approach to fitBounds in osmdroid(or is there fitBounds itself!!)?

Thanks in advance :)

asked 07 Jun '16, 14:14

Arun%20Gowtham's gravatar image

Arun Gowtham
0111114
accept rate: 0%

edited 07 Jun '16, 20:32

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554


There is a solution on Stack Overflow. Basically you have to compute a bounding box by iterating over your markers and calculating min/max lat and lon. Then just call zoomToBoundingBox().

permanent link

answered 07 Jun '16, 16:58

scai's gravatar image

scai ♦
33.3k21309459
accept rate: 23%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×181
×113
×47
×1

question asked: 07 Jun '16, 14:14

question was seen: 5,413 times

last updated: 07 Jun '16, 20:32

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum