passing instructions to Google Earth through Java

M

matthewburton

Hi,

I'm a student trying to build a system that controls Google Earth
through alternative input devices. I want to use Java to listen to my
serial port, translate the data into XML (with the help of the Google
Earth API), and pass this XML to Google Earth with instructions to
change its view according to the XML. Is it practical to tell an
outside application to take instructions from a Java program? Any
suggestions on how to do so or ideas for other approaches would be very
helpful. This whole idea might seem odd, but I'm doing it mainly to
learn the inner workings of GE and pick up some new Java skills, not to
build a marketable device, so it's fine if it turns out clunky.


thanks,
Matt
 
A

Andrew Thompson

I'm a student trying to build a system that controls Google Earth
through alternative input devices. I want to use Java to listen to my
serial port, ...

What special significance is the serial port?
...translate the data into XML (with the help of the Google
Earth API), and pass this XML to Google Earth with instructions to
change its view according to the XML.

According to this,
<http://www.keyhole.com/kml/kml_tut.html>
the Google Earth API can be configured by XML in the
form of a KML file. The last section refers specifically
to the mime-types that need to be configured for the server,
so that the client system recognizes the content correctly
(and takes the appropriate action, such as open 'Google Earth'
with the file).

That suggests that Google Earth is designed to be externally
configured in ways that are simpler than direct interaction
via the serial port.
 
M

matthewburton

Thanks, Andrew. I'd read the KML docs, but the implication of the last
paragraph didn't dawn on me until now.

I want to use a joystick to control Google Earth navigation. The
significance of the serial port is that my class has done lots of
labwork with serial output through variable resistors and PIC
microchips. My first thought was to let the joystick's two
potentiometers fill the role of the variable resistor. I would then
debug the joystick's output and write a Java program that translates
this output into GE-relevant values.
That suggests that Google Earth is designed to be externally
configured in ways that are simpler than direct interaction
via the serial port.

If I can find an easier way to do this, my professor would probably be
open to it. But I don't see how I'm gonna get around the serial port.
 
J

JScoobyCed

If I can find an easier way to do this, my professor would probably be
open to it. But I don't see how I'm gonna get around the serial port.

There is the Java Communication API that can be used to read/write
from/to serial and parallel ports. But it needs to obey the standard
protocols.
If your joystick follows the serial communication protocol (RS-232),
then you can send binary data to the serial port, which can be read from
Java and then translated to KML.
 
D

Dag Sunde

Thanks, Andrew. I'd read the KML docs, but the implication of the last
paragraph didn't dawn on me until now.

I want to use a joystick to control Google Earth navigation. The
significance of the serial port is that my class has done lots of
labwork with serial output through variable resistors and PIC
microchips. My first thought was to let the joystick's two
potentiometers fill the role of the variable resistor. I would then
debug the joystick's output and write a Java program that translates
this output into GE-relevant values.


If I can find an easier way to do this, my professor would probably be
open to it. But I don't see how I'm gonna get around the serial port.

So what you want is to start GE and your app. with GE showing some default
point.

When you move your joystick, you want GE to pan the map-picture N/S/E/W?

If so, Your app must know the start coordinates (Can probably get
this info from GE via KML).

Then you need to poll your joystick, registering the direction of motion,
scale/translate the joystick values into offsets from the original
coordinate (lat/lon).

Calculate a new absolute coordinate (lat/lon), and send these to GE as an
KML file.

(If I understood you correctly, that is)
 
M

matthewburton

Dag, both you and JSC have the right idea. Thanks for your ideas.

Translating the serial data into XML strings won't be a problem. What
I'm unsure of is how to write these strings to a file. My default
coordinates are in an existing KML file, and I just want to tell Java,
"replace those coordinates with the ones I just created."

It's essential that the program be able to do update the data
perpetually, with every move/click on the joystick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,876
Messages
2,569,932
Members
46,206
Latest member
BernardPer

Latest Threads

Top