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.1k16239551


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 ♦
31.4k18285439
accept rate: 23%

Your answer
toggle preview

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:

×161
×109
×40
×1

question asked: 07 Jun '16, 14:14

question was seen: 2,724 times

last updated: 07 Jun '16, 20:32

powered by OSQA