geo2web.com

Review of GIS GPS GEO and MAPs technology

geo2web.com header image 4

Tutorial 2: Making Embeded WWJava Zoom to a Location

August 10th, 2008 · No Comments · GIS and GEO technology, Maps

::: via :::

In Tutorial 1, we went into just how to embed a WWJava applet into a web page. In this tutorial I will expand the scope and use Javascript to make the globe move to a preset location after the applet loads. Note: I have noticed a bug while working on this tutorial with Firefox 3.x. Javascript interaction with the WWJava globe does not seem to work. It did work in FF 2.x, I am not sure if it is a FF issue or a WWJava issue though.

First off open up your web page that has the WWJava applet code in and we will be adding the following Javascript to it:

<script language="javascript">
<!--
// Author: Patrick Murris
// Version: // Applet init, start and stop - called from java at the end of applet init() and start()
// and at the begining of stop() function appletInit() {
} function appletStart() {
// Fly to a location after a delay
setTimeout("startup()", 5000); // 5 seconds
}

This part of the code starts the startup function after a delay of 5 seconds.

function startup() {
// Move to show overview
gotoLocation(GOTO_OVERVIEW);
}

In this tutorial, startup will be calling the gotoLocation function, this loads the function and also the variable that defines what the goto location is.

function appletStop() {
} var GOTO_OVERVIEW = "Detroit;42.46;-83.16;260000;0;40";

This is where you define your zoom to location.

Location strings contain the following information separated by ‘;’:

  • name displayed on the globe
  • latitude in decimal degrees
  • longitude in decimal degrees
  • eye distance from location in meters
  • heading angle in decimal degrees, clockwise from north
  • pith angle from vertical in decimal degrees
function gotoLocation(locationString) {
var params = locationString.split(';');
if(params.length == 3) // Lat/lon
document.getElementById('wwjApplet').getSubApplet().gotoLatLon(parseFloat(params[1]), parseFloat(params[2]));
else if(params.length == 4) // Lat/lon and zoom
document.getElementById('wwjApplet').getSubApplet().gotoLatLon(parseFloat(params[1]), parseFloat(params[2]), parseFloat(params[3]), 0, 0);
else if(params.length == 5) // Lat/lon/zoom and heading
document.getElementById('wwjApplet').getSubApplet().gotoLatLon(parseFloat(params[1]), parseFloat(params[2]), parseFloat(params[3]), parseFloat(params[4]), 0);
else if(params.length == 6) // Lat/lon/zoom/heading and pitch
document.getElementById('wwjApplet').getSubApplet().gotoLatLon(parseFloat(params[1]), parseFloat(params[2]), parseFloat(params[3]), parseFloat(params[4]), parseFloat(params[5]));
} // -->
</script>

This function is what processes the goto location values and then displays the location on the WWJava globe.

This is the finished HTML page now:

<html>
<head>
<title>NASA World Wind Java Applet</title>
</head> <script language="javascript">
<!--
// Author: Patrick Murris
// Version: // Applet init, start and stop - called from java at the end of applet init() and start()
// and at the begining of stop() function appletInit() {
} function appletStart() {
// Fly to a location after a delay
setTimeout("startup()", 5000); // 5 seconds
} function startup() {
// Move to show overview
gotoLocation(GOTO_OVERVIEW);
} function appletStop() {
} var GOTO_OVERVIEW = "Detroit;42.46;-83.16;260000;0;40"; function gotoLocation(locationString) {
var params = locationString.split(';');
if(params.length == 3) // Lat/lon
document.getElementById('wwjApplet').getSubApplet().gotoLatLon(parseFloat(params[1]), parseFloat(params[2]));
else if(params.length == 4) // Lat/lon and zoom
document.getElementById('wwjApplet').getSubApplet().gotoLatLon(parseFloat(params[1]), parseFloat(params[2]), parseFloat(params[3]), 0, 0);
else if(params.length == 5) // Lat/lon/zoom and heading
document.getElementById('wwjApplet').getSubApplet().gotoLatLon(parseFloat(params[1]), parseFloat(params[2]), parseFloat(params[3]), parseFloat(params[4]), 0);
else if(params.length == 6) // Lat/lon/zoom/heading and pitch
document.getElementById('wwjApplet').getSubApplet().gotoLatLon(parseFloat(params[1]), parseFloat(params[2]), parseFloat(params[3]), parseFloat(params[4]), parseFloat(params[5]));
} // -->
</script> <body> <applet id="wwjApplet" name="wwjApplet" mayscript code="org.jdesktop.applet.util.JNLPAppletLauncher" width=600 height=380
archive="applet-launcher.jar, http://worldwind.arc.nasa.gov/java/demos/worldwind.jar, WWJApplet.jar, http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jar, http://download.java.net/media/gluegen/webstart/gluegen-rt.jar">
<param name="codebase_lookup" value="false" />
<param name="subapplet.classname" value="gov.nasa.worldwind.examples.applet.WWJApplet" />
<param name="subapplet.displayname" value="WWJ Applet" />
<param name="noddraw.check" value="true" />
<param name="progressbar" value="true" />
<param name="jnlpNumExtensions" value="1" />
<param name="jnlpExtension1" value="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp" />
</applet> </body>
</html>

The output looks like this:


wwJava applet first loaded


Globe zooming into the defined location after 5 seconds


Final stopping point

[Read more →]

Tags:

Indexing Reality: Creating a Mine of Geospatial Information

August 10th, 2008 · No Comments · GIS and GEO technology, Maps

::: via :::

What if we had an accessible and accurate digital replica of the world? What could we make from it and what new knowledge could we create? Online maps and virtual globes are now becoming common visualization tools for geographic content and immersive geo-referenced imagery is providing a new way to experience the world from a street level perspective.

Anthony Fassero co-founder of Earth Mine inc presents an insight into using spatially referenced panoramas for tagging data:

Taken from O’Reilly Where 2.0 Conference, Burlingame, CA, May 13, 2008 Earth Mine is shaping to be one of the most exciting technologies since the release of Google Earth for spatial information.

We have covered Earth Mine for a while and according the website API products will be in private beta during the summer of 2008 (ie now). Those interested in the beta can apply online.

See http://www.earthmine.com/ for more information.

[Read more →]

Tags: