World Wind Forums

Go Back   World Wind Forums > Community > Add-ons & Scripts

Add-ons & Scripts Find add-ons, scripts, and utilities for World Wind.

Reply
 
Thread Tools Display Modes
Old 12-30-2004, 10:50 AM   #1
canosso
Senior Member
 
Join Date: Oct 2004
Location: Austria
Posts: 342
canosso
Default

Hello,
there was often an request for a movie and a download script.
Thanks to the JavaScript Counter using setTimeout, I written a script with Javascript.

For writing a movie with individual spots or download them, look at the script at post #5. You can even import your GPX data but only moving to this spots, not showing a track. Please find below the text file of this script, moviescriptdefined.txt

Copy this script in a text file and change the file format of this file to .htm, then start this file. You can also download the file moviescriptprompt.txt from the attachment and change the file format of this file to .htm.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<title>Movie and Download with World Wind by input the values</title>
</head>
<body onload="worldwind();">
<div name="fred" id="fred" style="position:absolute;top:0;left:20;"></div><BR>
<script type="text/javascript">

<!--
var startlat = prompt("Insert Start Latitude",""); //Prompt for Input of Start Latitude
var endlat = prompt("Insert End Latitude",""); //Prompt for Input of End Latitude
var startlong = prompt("Insert Start Longitude",""); //Prompt for Input of Start Longitude
var endlong = prompt("Insert End Longitude",""); //Prompt for Input of End Longitude
var delay = prompt("Insert Delay (0 = Movie, 10 seconds; 1 = Download, 30 minutes; all others = seconds)","0");
var vi = prompt("Insert Number of Viewing Level (B, 0-6) or Altitude (B=Blue Marble, Landsat7 Levels 0=below 740000 m, 6=below 12000 m; all others=Altitude in m)","3");//Prompt for Input of Viewing Level or Altitude
var xdiff = prompt("Insert the distance between spots in north south direction im kilometres","10"); //Prompt for Input of the Distance of the spots
var ydiff = prompt("Insert the approximately distance between spots in east west direction im kilometres","10"); //Prompt for Input of the Distance of the spots
x1 = parseFloat(startlat);
x2 = parseFloat(endlat);
y1 = parseFloat(startlong);
y2 = parseFloat(endlong);
switch(delay) { //Parse the Delay
  case "0":
    var delaytime=10000; 
  break;
  case "1":
    var delaytime=1800000;
  break; 
    default:
    var delaytime=parseInt(delay)*1000;
    break;
} //End of parsing
switch(vi) { //Parse the View
  case "B":
    var view=14.36291495; 
  break;
  case "0":
    var view=13.39; 
  break;
  case "1":
    var view=6.76;
  break;
  case "2":
  var view=3.28;
   break;
   case "3":
     var view=1.71;
   break;
   case "4":
     var view=0.84;
   break;
   case "5":
     var view=0.41;
   break;
     case "6":
     var view=0.21;
   break;
     default:
     var view=parseInt(vi)/55699;
     break;
} //End of parsing

xdifference=parseFloat(xdiff)/60; 
ydifference=parseFloat(ydiff)/60; 

x3=x1;
y3=y1;
xyn=0;
i=0;
j=0;

if (y1<y2) { //Change the Start Longitude if the End Longitude >Start Longitude
   y1=y2;
   y2=y3;
   y3=y1;
}//


do{                //count how many spots will be used
   do 
    { y1=y1-ydifference;
    xyn=xyn+1
         if(y1==y2)break;
  }while (y1 > y2 ) 
  x1=x1+xdifference; 
  y1=y3 
    if(x1==x2)break; 
}while (x1 < x2 ) //end of counting the soots

document.write(xyn); // Number of different URL, this line could be removed, URL means a spot in World Wind

differenturl=new Array(xyn); //write an array with data of the spots
for (var i=0; i<differenturl.length; i++)
  differenturl[i]=0;
y1=y3;
x1=x3;
document.write('<table><TR><TH CLASS="js">Latitude<\/TH><TH CLASS="js">Longitude<\/TH><TH CLASS="js">Link<\/TH><\/TR>'); //This line could be removed
do { 
  do {
    var url="worldwind://goto/world=Earth&lat=" + x1 +"&lon="+ y1 +"&view="+view;
    document.write('<TR><Td CLASS="js">'+x1+'<\/Td>');                //These 3 lines could be removed, there are only for information about the different URl
    document.write('<Td CLASS="js">'+y1+'<\/Td>');                  // 
    document.write('<Td CLASS="js">'+"<a href='"+url+"'>"+url+"<\/a>"+'<\/Td><\/TR>'); //
    differenturl[j]=url;
    j=j+1;
    y1=y1-ydifference;
  }while (y1 > y2 )
  x1=x1+xdifference;
  y1=y3
}while (x1 < x2 )

document.write('<\/table>'); //This line could be removed, end of writing the array

i=-1;
function worldwind(){ // show the current spot and start or move World Wind to this spot
  i++; 
  changelayer_content(i);
  if (i<differenturl.length){
    Id = window.setTimeout("worldwind()",delaytime);
    location=differenturl[i];
    } 
  else{
  window.stop();
}
}  //end of current spot

function changelayer_content(counter){ //function to write the current spot
  msgstring="<a href='"+differenturl[counter]+"'>"+differenturl[counter]+"<\/a>"+"<br>";

  if(document.layers){
  //thisbrowser="NN4";
    fredlayer = document.layers[0];
    fredlayer.document.open();
    fredlayer.document.write(msgstring);
    fredlayer.document.close();
    }
  if(document.all){
    //thisbrowser="ie"
    fredlayer = document.all["fred"];
    fredlayer.innerHTML=msgstring;
    }
  if(!document.all && document.getElementById){
    //thisbrowser="NN6";
    fredlayer = document.getElementById("fred");
    fredlayer.innerHTML =msgstring;
  }
}// end of function

// -->
</script>
</body>
</html>
This script writes first a table with the different spots which in the square starting from the start latitude and longitude to the end latitude and longitude.The square starts from the upper left to the down right, therefore the Start Longitude will be changed with the End Longitude if the last one is larger.

You will get different windows to input your parameters, first "Start Latitude", then "End Latitude", then "Start Longitude" and "End Longitude". You will also be asked for the Delay for the moving between different spots and the altitude of World Wind, higher level will be loaded automaticlly. Also you can input the difference in kilometres between the different spots.

The script shoud be useable also for view or downloading USGS, I don't know whether the view parameter is fine for this.

I hope that I helped and that I not confused everybody.

canosso

[attachmentid=247] (=Script where you will be asked to insert the variables in a window)

[attachmentid=248] (=Script for individual spots)

[attachmentid=249] (=Script where you input your data in the script)
Attached Files
File Type: txt moviescriptprompt.txt (4.9 KB, 798 views)
File Type: txt moviescriptdefined.txt (3.9 KB, 707 views)
File Type: txt moviescript.txt (4.0 KB, 583 views)
__________________
My Plug-ins for World Wind
canosso is offline   Reply With Quote
Old 12-30-2004, 03:49 PM   #2
Astroboy
Junior Member
 
Join Date: Oct 2004
Location: Netherlands
Posts: 12
Astroboy
Default

Quote:
Originally posted by canosso@Dec 30 2004, 11:50 AM
Hello,
there was often an request for a movie and a download script.
Thanks to the JavaScript Counter using setTimeout, I written a script with Javascript.

Copy this script in a text file and change the file format of this file to .htm, then start this file. You can also download the text file from the attachment and change the file format of this file to .htm.

This script writes first a table with the different spots which in the square starting from the start latitude and longitude to the end latitude and longitude. Please take notice that this square starts from the upper left to the down right, therefore the Start Longitude is larger then the End Longitude.

You have only to fill in the two Longitudes and Latitudes. Please use decimal point, no comma. Then the table will be shown and on the top the address of the current spot will be shown and World Wind will be started or moved to this spot.

For using the script to download, you have to change the delaytime to 1800000 milliseconds.

You can change view, only change the number of the level, the different levels are the resolution of Landsat7 Data, level6 is the highest.

You can also change the xdifference and ydifference, 0.1875 is about 22 kilometres, the difference could be also changed through a mathematic function, like x=xテつイ, but take care of the earth limitations .

The view could also be changed by zooming in, only insert another loop at the array definiton.

I hope that I helped and that I not confused everybody.

canosso
Thank you very much Canosso for this file you provide.
I've changed the lat. and lon. for my country (Holland) and also after each "scan" the level.
While it scans I shut off the placenames, borders, lat. and lon. position and the lat. and lon. lines, then it goes at it fastest way to download the tiles.
Thanks again!

Robert
Astroboy is offline   Reply With Quote
Old 12-30-2004, 05:24 PM   #3
canosso
Senior Member
 
Join Date: Oct 2004
Location: Austria
Posts: 342
canosso
Default

Hello Robert,
Quote:
Originally posted by Astroboy@Dec 30 2004, 07:49 AM
Thank you very much Canosso for this file you provide.
I've changed the lat. and lon. for my country (Holland) and also after each "scan" the level.
While it scans I shut off the placenames, borders, lat. and lon. position and the lat. and lon. lines, then it goes at it fastest way to download the tiles.
Thanks again!
Robert
You don't need to restart for the different levels, only insert highest level you want to see and start, then it will also download the tiles from a lower level.

canosso
__________________
My Plug-ins for World Wind
canosso is offline   Reply With Quote
Old 12-30-2004, 08:03 PM   #4
Astroboy
Junior Member
 
Join Date: Oct 2004
Location: Netherlands
Posts: 12
Astroboy
Default

Quote:
Originally posted by canosso@Dec 30 2004, 06:24 PM
Hello Robert,
You don't need to restart for the different levels, only insert highest level you want to see and start, then it will also download the tiles from a lower level.

canosso
I started the other way around, with level 0 to level 6. I have a lot more tiles than you describe.
With the highest level I set the difference to 0.1 degree and the delay to 30 to 60 seconds to let the program download all the tiles of the different levels.
Thank you.

Robert
Astroboy is offline   Reply With Quote
Old 12-30-2004, 08:22 PM   #5
canosso
Senior Member
 
Join Date: Oct 2004
Location: Austria
Posts: 342
canosso
Default

Hello,
it's me again, now I changed the script that predefined spots could be used, e.g. GPX Data. Sorry this script is not showing a line of the different spots, only visiting the spots.

For import of GPX Data, use GPS Visualizer Converter and convert the file into text. This text import in a spreadsheet, transform the Latitude and Longitude, so you will have them in one row, copy each row in a word processor as raw text, replace the TABs with comma and copy this line in the script below.

Code:
<HTML>
<head>
<title>Movie and Download with World Wind with individual spots</title>
</head><BODY onLoad="worldwind();">
<div name="fred" id="fred" style="position:absolute;top:0;left:20;"></div><BR>
<script type="text/javascript">
<!--
var fredlayer;
delaytime=10000; //This is the waiting time between the change of the different spots. For movie 10000 milliseconds (=10 seconds) are fine, if you reduce the timeout the placename will not be shown テつ*For download 1800000 milliseconds should be used , these are 30 minutes. If you want to use an array of delaytime, delete this line
levelB=14.36291495; //only Blue Marble, ~ 800000 metres
level0=13.39; //lower than 740000 metres
level1=6.76; //lower than 384000 metres
level2=3.28; //lower than 192000 metres
level3=1.71; //lower than 96000 metres
level4=0.84; //lower than 48000 metres
level5=0.41; //lower than 24000 metres
level6=0.21; //lower than 12000 metres
view=level3; テつ*//change here only the number of the level starting from 0 to 6 to the highest level you want to see. 6 is the highest resolution, lower level tiles will be loaded automaticly. If you want to use an array of Altitude, delete this line
xyn=; // Insert here the number of the different spots
i=0;
j=0;

document.write(xyn); // Number of different URL, this line could be removed, URL means a spot in World Wind
differenturl=new Array(xyn); テつ*//write an array with data of the spots
for (var i=0; i<differenturl.length; i++)
	differenturl[i]=0;

var xcords=new Array();//Insert the latitude of the different spots, seperated by comma. Please use decimal point

var ycords=new Array();//Insert the longitude of the different spots, seperated by comma. Please use decimal point

//var delaytime=new Array();// If you want to move at different time or you have GPS time data, you can define an array of テつ*delaytime, remove the two slashes

//var view=new Array();// If you want to view at different Altitude, you can define an array of Altitude, remove the two slashes

document.write('<table><TR><TH CLASS="js">Latitude<\/TH><TH CLASS="js">Longitude<\/TH><TH CLASS="js">Link<\/TH><\/TR>'); 
i=0;
do{
 テつ* テつ*var url="worldwind://goto/world=Earth&lat=" + xcords[i] +"&lon="+ ycords[i] +"&view="+view;////If you made an array of Altitude, please replace view with view[i]
 テつ*document.write('<TR><Td CLASS="js">'+ycords[i]+'<\/Td>'); テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* //These 3 lines テつ*could be removed, there are only for information about the different spots
 テつ* テつ*document.write('<Td CLASS="js">'+xcords[i]+'<\/Td>'); テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ* テつ*// テつ*
 テつ*document.write('<Td CLASS="js">'+"<a href='"+url+"'>"+url+"</a>"+'<\/Td><\/TR>'); //
 テつ*differenturl[i]=url;
 テつ* テつ* テつ* テつ*i++;
}while (i<differenturl.length);

document.write('<\/table>'); //This line could be removed, end of writing the array

i=-1;
function worldwind(){ // show the current spot and start or move World Wind to this spot
	i++; 
	changelayer_content(i);
	if (i<differenturl.length){
 テつ*	Id = window.setTimeout("worldwind()",delaytime);//If you made an array of delaytime, please replace delaytime with delaytime[i]
 テつ*	location=differenturl[i];
 テつ*} 
	else{
 テつ*window.stop();
}
} //end of current spot

function changelayer_content(counter){ //function to write the current spot
msgstring="<a href='"+differenturl[counter]+"'>"+differenturl[counter]+"</a>"+"<br>";

	if(document.layers){
	//thisbrowser="NN4";
 テつ* fredlayer = document.layers[0];
 テつ*	fredlayer.document.open();
 テつ*	fredlayer.document.write(msgstring);
 テつ*	fredlayer.document.close();
 テつ* テつ* テつ* テつ*}
	if(document.all){
 テつ*	//thisbrowser="ie"
 テつ*	fredlayer = document.all["fred"];
 テつ*	fredlayer.innerHTML=msgstring;
 テつ* テつ* テつ* テつ*}
	if(!document.all && document.getElementById){
 テつ*	//thisbrowser="NN6";
 テつ*	fredlayer = document.getElementById("fred");
 テつ*fredlayer.innerHTML =msgstring;
 テつ*}
}// end of function
// -->
</script>
</body>
</html>
You have to fill in the number of the different spots at xyn and the lines with latitudes and longitudes at xcords and ycords.

canosso

[attachmentid=248] (=Script for individual spots)
__________________
My Plug-ins for World Wind
canosso is offline   Reply With Quote
Old 01-02-2005, 01:54 PM   #6
ciprian.samoila
Junior Member
 
Join Date: Jan 2005
Posts: 1
ciprian.samoila
Default

Can someone teach me how to actually make that work for ROmania?
Show me each step i need to take.

Thank you in advance.
Ciprian
ciprian.samoila is offline   Reply With Quote
Old 01-02-2005, 05:08 PM   #7
canosso
Senior Member
 
Join Date: Oct 2004
Location: Austria
Posts: 342
canosso
Default

Hello Ciprian,

Quote:
Originally posted by ciprian.samoila@Jan 2 2005, 05:54 AM
Can someone teach me how to actually make that work for ROmania?
Show me each step i need to take.

Thank you in advance.
Ciprian
Enter the Start Latitude 47.9298, Start Longitude 22.53, End Latitude 44.00 and End Longitude 27.70. Change the delaytime to 1800000 and choose the highest level you want to see. Now will scan the largest part of the country. For the eastern smaller part take Start Latitude 45.50, Start Longitude 27.70, End Latitude 43.44 and End Longitude 29.13. For the western part you will better to choose individual points. But the whole downloading at level 4 will take a longer time, with higher levels it takes days or weeks.

canosso
__________________
My Plug-ins for World Wind
canosso is offline   Reply With Quote
Old 01-02-2005, 11:10 PM   #8
Lucian
OnEarth admin
 
Lucian's Avatar
 
Join Date: Sep 2004
Posts: 183
Lucian is an unknown quantity at this point
Default

90% or more of that time is the conversion that WW does on your machine, from JPEG
to textures. If you just want an image, use the server OnEarth.jpl.nasa.gov directly.

Lucian

Quote:
Originally posted by canosso@Jan 2 2005, 10:08 AM
Hello Ciprian,
Enter the Start Latitude 47.9298, Start Longitude 22.53, End Latitude 44.00 and End Longitude 27.70. Change the delaytime to 1800000 and choose the highest level you want to see. Now will scan the largest part of the country. For the eastern smaller part take Start Latitude 45.50, Start Longitude 27.70, End Latitude 43.44 and End Longitude 29.13. For the western part you will better to choose individual points. But the whole downloading at level 4 will take a longer time, with higher levels it takes days or weeks.

canosso
__________________
Any views or opinions presented here are solely those of the author and do not necessarily represent those of Caltech, JPL or NASA. I am not a NASA employee.
Lucian is offline   Reply With Quote
Old 01-05-2005, 01:08 PM   #9
Guest
Guest
 
Posts: n/a
Default

How do you get it to run? I put the the lat, long, and changed the view to 6. I saved it as a html file on my desktop and double clicked in it and nothing happned. I also had world wind opened and tried it, and nothing happned.

Also, if I understand how this works, I can put in a lat & long block and it will download everything in that block with all view levels (I selected 6) and save it in the cashe folder?
  Reply With Quote
Old 01-05-2005, 02:25 PM   #10
canosso
Senior Member
 
Join Date: Oct 2004
Location: Austria
Posts: 342
canosso
Default

Hello Guest,

Quote:
Originally posted by Guest@Jan 5 2005, 05:08 AM
How do you get it to run? I put the the lat, long, and changed the view to 6. I saved it as a html file on my desktop and double clicked in it and nothing happned. I also had world wind opened and tried it, and nothing happned.

Also, if I understand how this works, I can put in a lat & long block and it will download everything in that block with all view levels (I selected 6) and save it in the cashe folder?
The problem is Javascript, if you enabled Javascript, it will work but letting Javascript run all time is risky. My script is free of bad routines.

Yes, it will download the whole block with all levels.

canosso
__________________
My Plug-ins for World Wind
canosso is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Movie and Download Script for World Wind 1.3 canosso Add-ons & Scripts 9 04-23-2005 03:35 PM


All times are GMT +1. The time now is 02:17 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.