Friday, August 11, 2006

Fun in Google Earth

Recently, our office, in connection with NASA-Ames, hosted a UAV vendor demonstration. About 6 UAV vendors were invited to bring their birds and sensors to Fort Hunter Liggett in Southern California to demonstrate their wares. One of the guys from our office who went there handed me a GIS shapefile of the flight path yesterday and asked me to bring it into Google Earth so that the altitude of the plane is reflected in 3D.

I've brought my BARC data into GE many times, but it's relatively simple. These data for the flight path required a varying elevation above ground level. The shapefile I got had an ID, latitude, longitude, and altitude. I converted altitude to AGL (above ground level) by subtracting the elevation of the runway (~310m) from the altitude. In theory, the AGL at takeoff and landing should be 0. There were over 23,000 features in this shapefile and I was afraid it'd really bog down GE, so I eliminated about a tenth of the points (taking every 4th point and then eliminating hundreds of duplicate points before takeoff and after landing). Then I figured out the KML code that would do this, particularly the altitudemode tag. Here's the code:


Placemark
Point
altitudeMode>relativeToGround
coordinates
-121.238566,35.995473,45
coordinates
Point
Placemark

Then I've got to repeat that Placemark tag over and over again to capture each point remaining in the flightpath shapefile. I had my father-in-law write up a Perl Script that read the DBF file from the shapefile, captured the ID, latitude, longitude, and AGL and pasted them in at the appropriate spots in the KML code. It took him 10-15 minutes to write the script, whereas it would have taken me all day in VB. I'm no Perl expert, so it would have taken me a month to write that Perl script. The result of the KML is shown below in the jpeg.



1 comment:

Papa Doc said...

Jess,
I am very pleased to see your work. I take no credit by saying I am proud of you. I am just very happy that you are doing something good for people and the earth we live in. The fact that you obviously enjoy doing it is just a great plus for you and us all.

I have just finished purusing your web sit. I see Mom has recently looked at it. You could answer her question. I am interested, too.

May your love for life, service, knowlege, and your family take you everywhere you want to go. Remember to be humble. This is just like when you were on your mission. I Love you so much.

Dad Clark