Jeffery J. Jensen, PE
Adjunct Professor
University of Nevada Las Vegas
Department of Civil and Environmental Engineering
4505 S Maryland Pkwy
Box 454015
Las Vegas NV 89154-4015
Email: jefferyjjensen@gmail.com
Mobile: 702-327-9294
Google Gadgets and Earth Plugin Table of Contents
Embed Google Earth Gadget in Unrestricted Webhost
(e.g. UNLV Student Account)
- Background information
- Benefits of Google Earth Gadget
- Quickly get Google Earth on your webpage
- Not required to signup for the Google API Key
- Disadvantages of Google Earth Gadget
- Limit customization with the Gadget, any detail changes requires
using the Google Earth AJAX API
- It appears you cannot use the webpage interface to edit an existing
Google Earth Gadget. Can only edit the HTML
- Step 0: read Google Tutorial: Embed your Google Earth Project in your Website
- Step 1: visit Embedded KML Viewer by Roman Nurik
http://www.gmodules.com/ig/creator?synd=open&url=http://code.google.com/apis/kml/embed/embedkmlgadget.xml
- Step 2: edit gadget settings
- Step 3: click the "Get the Code" button and copy the HTML code
- Step 4: on your webpage, edit your HTML file (e.g. H:/public_html/index.htm)
and paste this code somewhere in the body section of the page
- Step 5: view the webpage. Note first time users of the Google Earth Plugin
will be prompted to install it
-
Google Gadgets and Google Earth API
How to embed Google Earth Gadget in Google Sites
- Step 1: Signup and login to Google Sites
- This step can be skipped if you already have a gmail account
- Click the Create Site button
- Fill in the required fields (that is provide a Site name,
such as UNLV on Google Earth Select a site and
who to share with (everyone in the world or only people I specify).
Enter the security text.)
- Within Google Sites, click the Create Page on the top right or if you
already own Google Sites account, then can choose Edit Page
- Select the Web Page radio button, give it a title and then put page
under Home.
- Step 2: obtain KML/KMZ file to display on Google Earth
- Option 1: Use existing KML/KMZ file
- Option 2: create KML/KMZ file
- Can easily create a KML/KMZ file using the Google Earth Pro desktop
application
- zoom to an area of interest in Google Earth
- Create a Point by clicking on the yellow thumbtack button called
'add placemark' on the toolbar
- Position the mouse over the area of interest in Google Earth, click,
give a name such as "my casa"
- Fill in a basic description
- click on the thumbtack in the new pop up to change the icon to a custom image
- click ok
- Export the point as a KMZ file by right click on your new place mark,
select "save place as" Click the
drop down menu to select:Local disk (C:), click temp, click save.
- Step 3: Attach KML/KMZ file
- The KML or KMZ file must available from the Internet, will not
work if it is just stored on your local computer
- Recommend attaching the KMZ file to your Google Sites webpage. This
should improve performance since everything is stored on the Google Servers
- expand the attachment area by clicking the plus sign to the left of attachments
- click browse, find local disc (C:), temp, and locate your KMZ file
- Expand the Attachments link and then click the browse button.
- Can also attached the KML/KMZ file in Google Sites. To get the
URL of the attachment, just right click and choose
Copy Shortcut
- Step 4: setup Google Earth Gadget
- Copy http://code.google.com/apis/kml/embed/embedkmlgadget.xml this URL.
- On the bottem right hand side click "View source" underneath the catogory titled "For Webmasters"
- Save the URL
- recommend opengin NotePad (Start Menu -> Programs -> Accessories -> NotePad)
- paste this url into notepad and hit return enough times so you can tell the difference between
this link and a future link you will soon paste underneath it.
- close the window that internet browser window that contains the source code you
don't need this page open anymore.
- In Google Sites, right click onto your place mark titled "my casa" or
whatever wordage you choose to put in and select "copy shortcut"
- paste this URL link into the existing notepad file
- Step 5
- return to Google Sites
- click on insert on the top left of the page, select more gadgets
- on the far bottem left of the pop up select "add gadget by URL"
- erase the http:// in the field it provides, and paste into it the top url you have pasted into notepad
- wait
- click add
- Where it says "KML or My Maps URL " erase all text provided and paste into this
field the bottom url you have pasted into notepad, your custom KMZ
- click save on the top right
- You should now have a new gadget that shows google earth in the backround on
your web page stating, "the google earth plug in is not currently instaled"
- install Google Earth Plugin/API. Only required one time. Just visit
http://code.google.com/apis/earth/ and click on the window to install
the Google Earth Plugin. Might get a yellow toolbar at the top of the browser
window, just right click on this and select install ActiveX control.
- Click, "get the google earth plug in now, click run,click run, and on the
top of your web site there should be a yellow bar. Right click this bar and
select,"run active x control, and select run for the last time I promise.
- the gadget should now zoom into your place of choosing congratulations.
- click save on the top right of your web page
- Step 6
- Tell your friends and family about your great success!
- After saving your site you need copy the url to notepad or just memorize it for the rest of your life so you can tell everyone where to see your new wonder
- sign out of google sites on the top right of the page
- paste in your link to make sure the page runs correctlly.
- celebrate if it does, if not, find your error.
- Step 9: edit the gadget
- If you want to edit the gadget properties, just click the gadget within
Google Sites, this will bring the Properties window up, that is the same
Setup your gadget window from Step 8. Note, do NOT
edit the HTML file
- Step 10: final results -
http://sites.google.com/site/jefferyjjensen/Home/unlv-on-google-earth
- Background on Google Sites - Benefits
Problem - Google Sites and Unsafe Tags (iframe, embeded, styles, script)
- Google Sites doesn't support iframe tags which is used by the Google Earth API
to embed the Google Earth Plugin in the web browser
- Google Earth Gadget also use iframe tags so you cannot embed it in the web browser
- Step 4: visit Google Earth Viewer Gadget
- BAD Step 4: click the Embed this gadget under the For webmasters section of the page
- GOOD Step 4: click View source >> link under the For webmasters section
of the paged
copy the URL of the Google Gadget source, that is,
http://hosting.gmodules.com/ig/gadgets/file/114026893455619160549/embedkmlgadget.xml
- BAD Step 5: provide the URL of the KML or KMZ file from Step 3 in
the Gadget settings
- BAD Step 6: click the Get the Code button and copy the HTML script
- BAD Step 7: If you attempt to edit or create a new page, then view HTML
then paste in the HTML code, you will get this error message and will NOT be
able to embed Google Earth into Sites
- GOOD Step 7: tip from Barry Hunter - Google sites doesn't allow embedding
arbitary code in a site, but it does allow carefully controlled code
via a Google Gadget. Goto Google Sites, and edit your page, then 'Insert'
menu and select 'More...' in the Gadgets section, on the popup, click
'Add by URL' and paste in the XML URL of Romans gadget which is from Step 4 -
http://hosting.gmodules.com/ig/gadgets/file/114026893455619160549/embedkmlgadget.xml
-
- Step 8: setup the gadget
- enter the URL for the KML/KMZ file from Step 2. Adjust the size of the gadget
if needed, then click the OK button. Then click Save in Google Sites. Then
you should see both Google Earth API and the KML file.
MySpace and Google Earth API/Google Gadgets
How to Install Google Earth API in Microsoft Office Live