Horizontal tilt?

24 views
Skip to first unread message

kdd

unread,
Jun 7, 2008, 1:47:14 AM6/7/08
to KML Developer Support - Google Earth Browser Plugin
Is horizontal tilt available? Like you can be xº tiled from the
ground?

Thanks.

kdd

unread,
Jun 7, 2008, 2:08:39 AM6/7/08
to KML Developer Support - Google Earth Browser Plugin

kdd

unread,
Jun 7, 2008, 2:29:12 AM6/7/08
to KML Developer Support - Google Earth Browser Plugin
Ok. This'll explain things better: http://code.google.com/apis/kml/documentation/cameras.html

In Camera, we have <roll /> "tag". In LookAt, we don't have that (or
that's what I'm thinking), is there any way to make roll work in the
Google Earth plug-in at this moment? Thanks!

marquies

unread,
Jun 7, 2008, 7:40:03 AM6/7/08
to KML Developer Support - Google Earth Browser Plugin
Yes you can.

var camera = ge.createCamera('xyz');
ge.getView().getAbstractView(camera);
camera.setRoll(45);
ge.getView().setAbstractView(camera);

Regards
Marquies

www.GONICUS.de

kdd

unread,
Jun 7, 2008, 1:33:41 PM6/7/08
to KML Developer Support - Google Earth Browser Plugin
Thank you very much Marquies. :) I'll test this out, and see how
things go.

Regards,
K.

kdd

unread,
Jun 7, 2008, 8:12:19 PM6/7/08
to KML Developer Support - Google Earth Browser Plugin
I'm still very new to this, could anyone please help out as I'm not
able to get this to work...

Again, I'm trying to get "roll" to work in Google Earth Browser Plug-
in. With the code marquies, getAbstractView has problems. I removed
that line, and with other 3 lines it doesn't actually do roll
(horizontal tilt), it just panned the camera to a different position.

Any help would be appreciated. Thanks!

kdd

unread,
Jun 7, 2008, 8:46:32 PM6/7/08
to KML Developer Support - Google Earth Browser Plugin
Sorry to repost, but I've some more information.

I was running "Profile" in Firebug in Firefox, and I was able to note
that there was no call to function "setRoll". I also noticed that
there is no such function documented (yet). There's a function called
set ( ... ). http://code.google.com/apis/earth/documentation/API.html#KmlAbstractView
Look at the middle part. I used that function, but not much is
happening or maybe since I'm very new to this, I just don't know how
to use it...

Again, I'm trying to set roll, but I'm not sure if it is supported at
this moment.

Thanks.
K.

marquies

unread,
Jun 8, 2008, 6:08:31 AM6/8/08
to KML Developer Support - Google Earth Browser Plugin
In the api doc are only the properties documented. But there are
getter and setter for each property. Can you post your code? I can
check it then.

regards
marquies
www.GONICUS.de

On 8 Jun., 02:46, kdd wrote:
> Sorry to repost, but I've some more information.
>
> I was running "Profile" in Firebug in Firefox, and I was able to note
> that there was no call to function "setRoll". I also noticed that
> there is no such function documented (yet). There's a function called
> set ( ... ).http://code.google.com/apis/earth/documentation/API.html#KmlAbstractView

kdd

unread,
Jun 8, 2008, 4:23:27 PM6/8/08
to KML Developer Support - Google Earth Browser Plugin
ge = null;

function getEarthInstanceCB ( object )
{
alert('hi');
ge = object;
var camera = ge.createCamera('xyz');
camera.setRoll(45);
ge.getView().setAbstractView(camera);
}

Before I had your code, and it was giving me errors.

And, I'm calling getEarthInstanceCB from another function. Alert with
'hi' does show up.

marquies

unread,
Jun 9, 2008, 1:29:59 AM6/9/08
to KML Developer Support - Google Earth Browser Plugin
Ok, your code does not work because the created GeCamera object has
null values for lat/lon/alt/etc.. try this:

function initCB(object) {
ge = object;
ge.getWindow().setVisibility(true);
var camera = ge.createCamera('xyz');
camera = ge.getView().copyAsCamera(ge.ALTITUDE_ABSOLUTE);
camera.setAltitude(100);
camera.setRoll(45);
camera.setTilt(90);
ge.getView().setAbstractView(camera);
}

regards
marquies
www.GONICUS.de

kdd

unread,
Jun 9, 2008, 1:13:23 PM6/9/08
to KML Developer Support - Google Earth Browser Plugin
Thank you for your time and interest. Unfortunately, this doesn't work
also...

Maybe I'm asking question in a confusing way...

This is what it looks like right now:
http://iplacebook.com/ipb_images/looksLike.gif

And this is what I want it to look like using roll:
http://iplacebook.com/ipb_images/wantToLookLike.gif

As you can see, the horizon is tilted.

Thank you. :)

K.

kdd

unread,
Jun 9, 2008, 1:20:53 PM6/9/08
to KML Developer Support - Google Earth Browser Plugin
Ok. I think <roll> is just not yet supported in this browser plug-in.

There's an example of "Parse KML" in Sample Example.
Paste the following kml that I got from here:
http://code.google.com/apis/kml/documentation/cameras.html in Roll
section, and as you can see it will not roll.

'<kml xmlns="http://earth.google.com/kml/2.2">' +
'<Document>' +
' <Placemark>' +
' <name>Roll left</name>' +
' <Camera>' +
' <longitude>-122.4783</longitude>' +
' <latitude>37.8120</latitude>' +
' <altitude>100</altitude>' +
' <heading>90</heading>' +
' <!-- east -->' +
' <tilt>90</tilt>' +
' <!-- level -->' +
' <roll>45</roll>' +
' <altitudeMode>absolute</altitudeMode>' +
' </Camera>' +
' </Placemark>' +
'</Document>' +
'</kml>'

I'm going to create another thread for feature request roll.
Thanks for your help! :)

K

marquies

unread,
Jun 10, 2008, 1:46:22 AM6/10/08
to KML Developer Support - Google Earth Browser Plugin

kdd

unread,
Jun 10, 2008, 2:06:30 PM6/10/08
to KML Developer Support - Google Earth Browser Plugin
Oh man, I exactly want that... Could you please post portion of the
code for my studying purposes? I have no idea where I'm making a
mistake. :(

Thanks, I appreciate your help! :)

kdd

kdd

unread,
Jun 10, 2008, 2:19:29 PM6/10/08
to KML Developer Support - Google Earth Browser Plugin
Yes, I exactly want that to happen in the browser plug-in object
thing.

Here's my complete javascript code:

function g ( itemName )
{
return document.getElementById(itemName);
}

function loadMap ( latitude , longitude )
{
if ( GBrowserIsCompatible() )
{
var map = new GMap2( g ( "map" ) );
var info = '<div class="textSmall" style="text-align: left;">' +
placeInfoStr + '</div>';

var mapOverviewControl = new GOverviewMapControl();

var point = new GLatLng ( latitude , longitude );
var infoWindowInitPoint = new GLatLng ( latitude+.0006 ,
longitude );
map.setCenter ( point , 16 );
map.addMapType ( G_SATELLITE_3D_MAP );
//map.setMapType ( G_HYBRID_MAP );

GEvent.addListener ( map , 'maptypechanged' , function()
{
if ( map.getCurrentMapType().getName() == 'Earth' )
{
//map.removeControl ( mapOverviewControl ); //Remove it, because
it screws up a lot of stuff.
}
else
{
//map.addControl ( mapOverviewControl );
}
} );
map.addControl ( new GLargeMapControl() );
map.addControl ( new GMapTypeControl() );
//map.addControl ( mapOverviewControl );
map.enableDoubleClickZoom ();
map.openInfoWindowHtml ( infoWindowInitPoint , info );


var marker = new GMarker(point);

function createMarker(point)
{
GEvent.addListener ( marker , 'click' , function()
{
marker.openInfoWindowHtml ( info );
});

return marker;
}
map.addOverlay ( createMarker ( point ) );
}

map.getEarthInstance ( initCB );
}

ge = null;

function initCB(object) {
ge = object;
ge.getWindow().setVisibility(true);
var camera = ge.createCamera('xyz');
camera = ge.getView().copyAsCamera(ge.ALTITUDE_ABSOLUTE);
camera.setAltitude(100);
camera.setRoll(45);
camera.setTilt(90);
ge.getView().setAbstractView(camera);

}


I must be screwing up something... Please note there are lines that
are commented out.

Thanks for helping, I appreciate your help! :)

kdd

marquies

unread,
Jun 11, 2008, 3:23:15 AM6/11/08
to KML Developer Support - Google Earth Browser Plugin
Ok, i can verify your problem. initCB will be called immediately after
call map.getEarthInstance ( initCB ). You set the roll in initCB. When
you switch from maps to earth, earth take over the view of maps, with
a setRoll(0). Replace initCB with this code

var camera;
var f = function() {
var me = this;
camera = ge.getView().copyAsCamera(ge.ALTITUDE_ABSOLUTE);
camera.setLatitude(47);
camera.setLongitude(11);
camera.setHeading(0);
camera.setRoll(45);
camera.setTilt(90);
ge.getView().setAbstractView(camera);
setTimeout(me, 1000);
}

function initCB(object) {
ge = object;
ge.getWindow().setVisibility(true);
camera = ge.createCamera('xyz');
setTimeout(f, 1000);
}

regards
marquies
www.GONICUS.de

kdd

unread,
Jun 11, 2008, 1:05:34 PM6/11/08
to KML Developer Support - Google Earth Browser Plugin
Oh yeah!!! It works! :)

Still tiny bit buggy due to my other code, but I think I can fix it
from here on.

Thank you very much Marquies for helping out! I appreciate your
help! :)

Regards,
kdd.
Reply all
Reply to author
Forward
0 new messages