how to fit zoom to a bounding box

61 views
Skip to first unread message

J P

unread,
Apr 26, 2021, 1:48:17 PM4/26/21
to openglobus
I'm porting some Leaflet map code to OpenGlobus and would like to have the camera zoom to a bounding box.

Leaflet code looks like this:

        map.fitBounds([

          [ data.boundingbox[0], data.boundingbox[2] ],
          [ data.boundingbox[1], data.boundingbox[3] ]

        ]);

I suspect I need to use createBoundsByExtent() and then zoom to the bounds.
A short example would help me here. I tried to grep through the examples for that function.

Side note: I think the API docs would also be a bit better with a few code lines how the described function should / could be used. At least the most important functions.


Michael Gevlich

unread,
Apr 27, 2021, 3:52:46 AM4/27/21
to openglobus
There are two functions flyExtent and viewExtent in the globe.planet object. Please take a look in the finctions parameters, maybe useful.

J P

unread,
Apr 27, 2021, 5:09:55 AM4/27/21
to openglobus
Thanks! Now I remember those Fly-functions again.
Reply all
Reply to author
Forward
0 new messages