tags:

views:

113

answers:

1

May i inquire more knowledge on marshaling and unmarshaling of kml codes? Regarding those used in Google earth. I need to do a project on flight airlines, linking them with an arc which is a polygon to connect placemarks with placemarks. I've tried to compile sample codes of HelloKML but still unable to marshal and produce the kml codes itself. Please someone explain marshaling and unmarshaling of codes and producing of kml codes. Thanks in advance.

A: 

KML files are just XML files using a specific set of tags and attributes. You can create KML files with an ordinary text editor such as Notepad. A simple KML file is probably a good place to start, just create a new blank text file and type in some KML (there are zillions of examples around the web). Load it into Google Earth and see if it works. If not, fix your KML.

Once you know how to create valid KML files manually, creating them automatically is then a simple matter of programming.

Greg Hewgill
Hey Greg, i've tried creating the kml with tags and attributes. Its the auto generating java codes which are a problem for me. I understood how kml works but for marshaling and unmarshaling, i can't seem to understand it. I can't figure out how to use java codes to generate the kml i want. Really need help. Thanks.
Kayson
@Kayson: I'm not sure what you mean by "marshaling and unmarshaling". Creating a KML file from Java is just writing a text file. Are you using some kind of library to create the KML file for you?
Greg Hewgill
@Greg: By import de.micromata.opengis.kml.v_2_2_0.Kml, kml library can be imported which consist of kml commands. Marshal and Unmarshaling is part of the kml library. I'm supposed to access a database and generate polygons which are paths of airline destination. I know kml files can be generated manually but i need to generate them automatically. Hope can get some help soon. Thanks.
Kayson
@Kayson: My best advice to you right now would be: Don't use that KML library. You don't need it. KML files are just text files; create them using the ordinary Java facilities for writing text files. If you *must* use that library, open a new question explaining your problem with that library. Not everybody uses the same library to create KML files.
Greg Hewgill