How to stop GE from auto zooming?

2,240 views
Skip to first unread message

PLen

unread,
Nov 17, 2007, 2:40:39 PM11/17/07
to KML Developer Support - Advanced Support for KML
Hello,

It seems that by default, GE will autozoom the map to fit new markers
that my KML places on the map. For example, I have NetworkLink that
will add new placemarkers. Once GE places the markers on the map, it
will auto zoom the map so that all of the markers fit nicely within
the view port.

My question is how can I prevent GE from doing the auto zoom? The
reason I ask is the following. I have a NetworkLink that has a
viewRefreshMode of onStop. Now, when the initial NetworkLink call is
made, I send up KML for markers within some area of the viewport.
When GE places the markers, it auto zooms. That auto zoom moves the
map which then triggers the next NetworkLink call when the map stops
moving. I then place another marker(s) and GE does another auto zoom,
which then again triggers another NetworkLink call. So in the end, I,
as a user, never had to touch my mouse. GE essentially created its
own endless loop of calling my NetworkLink simply because it moved the
map with its auto zoom. Even after the zoom is as far in as it will
go, the NetworkLink continues to get called every 3 seconds.

There must be a way in the KML that I return from a NetworkLink call,
that will simply allow me to place my markers and not have GE do its
auto-zoom.

Thoughts? - Peter

barryhunter [KML Guru]

unread,
Nov 18, 2007, 8:16:17 AM11/18/07
to KML Developer Support - Advanced Support for KML
I dont think GE does that by default, at least I have view based
refreshes[1] that dont auto zoom each time they load,

Check you don't have FlyToView set:
http://code.google.com/apis/kml/documentation/kml_tags_beta1.html#flytoview


[1] See http://www.nearby.org.uk/google.html eg number 4 or 7

PLen

unread,
Nov 18, 2007, 6:11:49 PM11/18/07
to KML Developer Support - Advanced Support for KML
Barry,

Thanks for the response. I have tried numerous KML alterations to my
NetworkLink and the resulting KML document from the NetworkLink URL,
but to no avail. Maybe I just have an odd scenario. Essentially, I
have a NetworkLink and when the URL is called the first time by GE, I
add a Placemark where I do want to do the fly to. On all subsequent
URL calls by GE, I have other Placemarkers and do NOT want the fly to
to occur. Here is my NetworkLink:

<NetworkLink>
<name>Data Layers Name</name>
<flyToView>1</flyToView>
<Link>
<href>http://www.myserver.com/myservlet<href>
<viewRefreshMode>onRequest</viewRefreshMode>
<viewFormat>BBOX=[bboxWest],[bboxSouth],[bboxEast],
[bboxNorth];CAMERA=[lookatLon],[lookatLat],[lookatRange]</viewFormat>
</Link>
</NetworkLink>

Having the <flyToView> as defined above has GE do a fly to each time
the NetworkLink URL is called.

Now, since I only want the fly to to happen after the first URL call
by GE, I took out the <flyToView> tag in the NetworkLink defined above
and tried several variations of KML returned by the server to try to
get GE to fly to the Placemarker in the KML document that gets
returned from the server (first call only). Here are some KML
variations:

1)
<Document>
<flyToView>1</flyToView>
<Placemark>........</Placemark>
</Document>


2)
<Document>
<LookAt>
<longitude>20.506021</longitude>
<latitude>41.293526</latitude>
</LookAt>
<flyToView>1</flyToView>
<Placemark>......</Placemark>
</Document>


3)
<Document>
<NetworkLinkControl>
<LookAt>
<longitude>20.506021</longitude>
<latitude>41.293526</latitude>
</LookAt>
<flyToView>1</flyToView>
<NetworkLinkControl>
<Placemark>........<Placemark>
</Document>

The above examples are for the KML that gets returned by the first GE
call to the NetworkLink URL. All subsequent calls via a "refresh"
just add Placemarks.

None of the above examples gets GE to do a fly to on the Placemark.

The KML API states the following for a <flyToView> element:
"A value of 1 causes Google Earth to fly to the view of the root
element in the refreshed file. In this case, Google Earth flies to the
<LookAt> view of the parent Document, not the <LookAt> of the
Placemarks contained within the Document."

I guess I must be confused as to what this really means. Maybe the
<flyToView> is suppose to be in the NetworkLink definition as is
listed at the top of this response and that once it is set, then that
is it. It is either always set (1) or never set (0).

Do have any further thoughts on this situation? Hopefully I explained
it clearly.

Thanks again - Peter


On Nov 18, 8:16 am, barryhunter [KML Guru] wrote:
> I dont think GE does that by default, at least I have view based
> refreshes[1] that dont auto zoom each time they load,
>
> Check you don't have FlyToView set:http://code.google.com/apis/kml/documentation/kml_tags_beta1.html#fly...
>
> [1] Seehttp://www.nearby.org.uk/google.htmleg number 4 or 7
>
> On Nov 17, 7:40 pm, PLen wrote:
>
>
>
> > Hello,
>
> > It seems that by default, GE will autozoom the map to fit new markers
> > that my KML places on the map. For example, I have NetworkLink that
> > will add new placemarkers. Once GE places the markers on the map, it
> > will auto zoom the map so that all of the markers fit nicely within
> > the view port.
>
> > My question is how can I prevent GE from doing the auto zoom? The
> > reason I ask is the following. I have a NetworkLink that has a
> > viewRefreshMode of onStop. Now, when the initial NetworkLink call is
> > made, I send up KML for markers within some area of the viewport.
> > When GE places the markers, it auto zooms. That auto zoom moves the
> > map which then triggers the next NetworkLink call when the map stops
> > moving. I then place another marker(s) and GE does another auto zoom,
> > which then again triggers another NetworkLink call. So in the end, I,
> > as a user, never had to touch my mouse. GE essentially created its
> > own endless loop of calling my NetworkLink simply because it moved the
> > map with its auto zoom. Even after the zoom is as far in as it will
> > go, the NetworkLink continues to get called every 3 seconds.
>
> > There must be a way in the KML that I return from a NetworkLink call,
> > that will simply allow me to place my markers and not have GE do its
> > auto-zoom.
>
> > Thoughts? - Peter- Hide quoted text -
>
> - Show quoted text -
Message has been deleted

nr

unread,
Nov 19, 2007, 3:54:51 PM11/19/07
to KML Developer Support - Advanced Support for KML
Have you experimented with returning the NetworkLinkControl element
from your server generated KML? From the KML documentation:

<flyToView>
Boolean value. A value of 1 causes Google Earth to fly to the view
of the LookAt or Camera in the NetworkLinkControl (if it exists). If
the NetworkLinkControl does not contain an AbstractView element,
Google Earth flies to the LookAt or Camera element in the Feature
child within the <kml> element in the refreshed file. If the <kml>
element does not have a LookAt or Camera specified, the view is
unchanged. For example, Google Earth would fly to the <LookAt> view of
the parent Document, not the <LookAt> of the Placemarks contained
within the Document.

This is how I think it should work:

Your NetworkLink should contain <flyToView>1</flyToView>.
Your server code should generate a <NetworkLinkControl> element with a
LookAt value for the first placemark returned.
Your server code should not generate a LookAt or Camera for any
additional returned placemarks.

I'm actually trying this but it's not working, perhaps a bug?

Networklink:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<NetworkLink>
<name>Data Layers Name</name>
<open>1</open>
<flyToView>1</flyToView>
<Link>
<href>http://hostname/test.py</href>
<viewRefreshMode>onRequest</viewRefreshMode>
<viewFormat>BBOX=[bboxWest],[bboxSouth],[bboxEast],
[bboxNorth];CAMERA=[lookatLon],[lookatLat],[lookatRange]</viewFormat>
</Link>
</NetworkLink>
</kml>

Generated KML first time (fly's to here):
<Document>
<Placemark>
<name>Untitled Placemark</name>
<Point>
<coordinates>68.59786105645925,5.286515202934736,0</coordinates>
</Point>
</Placemark>
<NetworkLinkControl>
<LookAt>
<longitude>68.59786105645928</longitude>
<latitude>5.286515202934736</latitude>
<altitude>0</altitude>
<range>550540.4726526999</range>
<tilt>0</tilt>
<heading>-0.004373143055102298</heading>
</LookAt>
</NetworkLinkControl>
</Document>

Generated KML second time (still fly's to here):
<Document>
<Placemark>
<name>Untitled Placemark</name>
<Point>
<coordinates>68.59786105645925,5.286515202934736,0</coordinates>
</Point>
</Placemark>
</Document>

If I return an empty <LookAt></LookAt> within the document, GE flies
to 0.00, 0.00. I wonder if there is a value such that it doesn't fly
anywhere, or if I am just interpreting the documentation incorrectly.

-NR
> > [1] Seehttp://www.nearby.org.uk/google.htmlegnumber 4 or 7

PLen

unread,
Nov 19, 2007, 4:21:12 PM11/19/07
to KML Developer Support - Advanced Support for KML
NR,

Thanks for the reply. I thought the same thing given the KML docs.
My #3 example had the NetworkLinkControl with a LookAt on one of the
points for the initial return. GE, however, did not zoom (fly to)
that location (I removed the flyToView from the NetworkLink and added
it to the returning KML Document). In any case, having the
<flyToView>1</flyToView> in the NetworkLink itself, always seems to
make GE zoom in around the placemarkers.

There must just be one combination that will work which I haven't
tried.

Peter
> > > [1] Seehttp://www.nearby.org.uk/google.htmlegnumber4 or 7
>
> > > On Nov 17, 7:40 pm, PLen wrote:
>
> > > > Hello,
>
> > > > It seems that by default, GE will autozoom the map to fit new markers
> > > > that my KML places on the map. For example, I have NetworkLink that
> > > > will add new placemarkers. Once GE places the markers on the map, it
> > > > will auto zoom the map so that all of the markers fit nicely within
> > > > the view port.
>
> > > > My question is how can I prevent GE from doing the auto zoom? The
> > > > reason I ask is the following. I have a NetworkLink that has a
> > > > viewRefreshMode of onStop. Now, when the initial NetworkLink call is
> > > > made, I send up KML for markers within some area of the viewport.
> > > > When GE places the markers, it auto zooms. That auto zoom moves the
> > > > map which then triggers the next NetworkLink call when the map stops
> > > > moving. I then place another marker(s) and GE does another auto zoom,
> > > > which then again triggers another NetworkLink call. So in the end, I,
> > > > as a user, never had to touch my mouse. GE essentially created its
> > > > own endless loop of calling my NetworkLink simply because it moved the
> > > > map with its auto zoom. Even after the zoom is as far in as it will
> > > > go, the NetworkLink continues to get called every 3 seconds.
>
> > > > There must be a way in the KML that I return from a NetworkLink call,
> > > > that will simply allow me to place my markers and not have GE do its
> > > > auto-zoom.
>
> > > > Thoughts? - Peter- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -

nr

unread,
Nov 19, 2007, 4:25:45 PM11/19/07
to KML Developer Support - Advanced Support for KML
On your #3 example try removing the NetworkLinkControl, and putting a
LookAt right under the Document element. It should fly to that LookAt.
Try this while keeping the flyToView 1 setting in the NetworkLink.
> > > > [1] Seehttp://www.nearby.org.uk/google.htmlegnumber4or 7

PLen

unread,
Nov 19, 2007, 9:41:01 PM11/19/07
to KML Developer Support - Advanced Support for KML
NR,

Thanks for the response again. What you described is a variation of
my #2 example. Leaving the <flyToView> within the NetworkLink will do
the flyto even without having the LookAt in the returning KML. My
problem is that I don't want a flyto on subsequent NetworkLink
refreshes. I tried leaving the <flyToView> in the NetworkLink and
then adding a <flyToView>0</flyToView> within the returning KML
(within the Document and within a NetworkLinkControl) of a refreshed
NetworkLink after the initial call thinking that it would turn off any
flyto. That didn't happen though. GE still zoomed in to the new
marker.

I think that in order to do what I want (flyto on initial NetworkLink
call but not on the subsequent calls), any <flyToView>1</flyToView>
cannot be in the NetworkLink definition itsefl, but rather in the
returning KML from a NetworkLink call. That way when you don't want a
flyto, you just don't return a <flyToView>. Unfortunately, I have
tried numerous variations of this with no success. Maybe it can't be
done.

I'll keep trying. Thanks for your help NR - Peter

Jonathan van Tuijl

unread,
Nov 24, 2007, 6:09:51 PM11/24/07
to KML Developer Support - Advanced Support for KML
Trying element combinations not described in the spec is unlikely to
work, such as flyToView in the NetworkLinkControl.

I'd personally try a NetworkLink that fliesToView, and <Update> the
flyToView to 0 on a refresh. Might need to put the file containing the
NetworkLink on a web server.

Jonathan
Reply all
Reply to author
Forward
0 new messages