Zooming to the extent of objects

34 visningar
Hoppa till det första olästa meddelandet

HugoDrx

oläst,
3 sep. 2008 12:37:542008-09-03
till KML Developer Support - Google Earth Browser Plugin
Hi all,

I am trying to figure out the best way to make GE zoom in to display
all points and polygons. I have done some work with the
setAbstractView but it's nowhere near as efficient as the GM
getBoundsZoomLevel
method.

Does anyone know how I can do something like I did with Maps -

bounds = GLatLngBounds(ne,sw);
map.setZoom(map.getBoundsZoomLevel(bounds));


Even better, would anyone have an example?

Thanks

HugoDrx

oläst,
3 sep. 2008 13:11:342008-09-03
till KML Developer Support - Google Earth Browser Plugin
Hi All,

Never mind, I found another post with a similar issue as mine (I just
put in the wrong keywords in my search) and I see that there is
currently not a simple way to do this yet.

Thanks anyway...

TinyGrasshopper

oläst,
4 sep. 2008 01:31:472008-09-04
till KML Developer Support - Google Earth Browser Plugin
Since i had to do it for my own site, I've put together some code to
zoom to the extents of a feature. Have a look at the source code of
this sample page:

http://www.tinyg.com/googlearthtest7.html

Basically you do:

zoomToFeature(plugin, feature);

where "plugin" is your plugin instance and feature is the feature to
zoom to.


The components of that function may also be useful:


extent = getFeatureExtent(plugin, feature);

This will return a LatLonAltBox with the extents of a feature
(including any sub features).


camera = createCameraFromRectangle(plugin, north, east, south, west);

This will return a camera that will show the extents between north,
south, east and west.


camera = createCameraFromLatLonAltBox(plugin, box);

This will return a camera that will show the extents within the given
LatLonAltBox.


Hope this is helpful,

Cheers,
Chris
Svara alla
Svara författaren
Vidarebefordra
0 nya meddelanden