Google Earth API

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Get Involved
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
User avatar
nuworld
Registered User
Posts: 339
Joined: Sat Oct 17, 2009 8:28 pm

Re: Google Earth API

Post by nuworld » Mon Dec 14, 2009 9:40 pm

Ok, I got it to work with the help of a moderator(tekgergedan) over on the Google earth community forum

http://bbs.keyhole.com/ubb/

This WILL! work on a phpbb3 board
Here is a quick run down of how to do it.
Google Earth API code is composed of two parts. One is two <script>s that needs to be within the <head> and the other is to be within a <div>.

The first <script> is a key that authorizes your web site while it is accessing the Google servers:
<script src="http://www.google.com/jsapi?key=YOUR_KEY_HERE"></script>

You can get your key here: http://code.google.com/apis/maps/signup.html

The second <script> is composed of functions that initialize GE on your web page. The minimal version of it is as follows:

<script type="text/javascript">
var ge;
google.load("earth", "1");
function init() {
google.earth.createInstance('map3d', initCallBack, failureCallBack);
}
function initCallBack(instance) {
ge = instance;
ge.getWindow().setVisibility(true);
}
function failureCallBack(errorCode) {
}
google.setOnLoadCallBack(init);
</script>

If desired, some extra codes can be added to make other GE layers or your map files to show up in the 3D Earth. Here are a lot of examples:
http://code.google.com/apis/earth/documentation/

In phpBB, all these goes into the overall_header.html template since <head> is in that file.

The second part of the API is a simple <div> where the Earth will appear with an id "map3d" within the <body>:
<div id="map3d" style="height: 400px; width: 600px;"></div>

<body> needs this call:
<body onload="init()">

As an advanced usage, you can also add buttons or checkmarks to let the users turn on and off layers and features of GE like the navigation controls, the grids, the roads, international borders, that you can find their examples in the documentation.

RossSEMI
Registered User
Posts: 51
Joined: Sat Feb 16, 2008 9:25 pm
Location: Warren, Michigan, USA

Re: Google Earth API

Post by RossSEMI » Wed Jan 06, 2010 6:29 pm

Just a 10 year rookie at this stuff.

Locked

Return to “[3.0.x] Support Forum”