Simple-KML icon indicating copy to clipboard operation
Simple-KML copied to clipboard

Creating a KML file in Android device.

Open Burakito opened this issue 11 years ago • 4 comments

Hi I'm a student doing my last year project, an Android app, in which I need to create a Kml file with multiples polygons from some data I get with the sensors (GPS & Accelerometer). In fact, I already have implemented the part in which it gets the longitude and latitude points, but I need to design the polygons and finally create the kml file. My question is whether I can do it with this 'Simple-Kml Parser'.

Thank you and congratulations for the parser, it's obvious that there is a big effort behind it.

Burakito avatar Mar 12 '13 18:03 Burakito

On 03/12/2013 11:55 AM, Burakito wrote:

Hi I'm a student doing my last year project, an Android app, in which I need to create a Kml file with multiples polygons from some data I get with the sensors (GPS & Accelerometer). In fact, I already have implemented the part in which it gets the longitude and latitude points, but I need to design the polygons and finally create the kml file. My question is whether I can do it with this 'Simple-Kml Parser'.

Thank you and congratulations for the parser, it's obvious that there is a big effort behind it.

— Reply to this email directly or view it on GitHub https://github.com/Ekito/Simple-KML/issues/7.

No, it's a parser. It takes apart a KML file and returns objects. What are you going to do with the KML when you have it?

brian32768 avatar Mar 13 '13 23:03 brian32768

Hey guys,

Actually Simple-KML can do more than the serialization KML file -> KML Java object. It can also write a java object to a KML file (see https://github.com/Ekito/Simple-KML/blob/master/SimpleKML/src/com/ekito/simpleKML/Serializer.java)

@Burakito I don't understand what you want to achieve. Do you want to draw your points on a map and provide a way to export to a KML file?

romainpiel avatar Mar 14 '13 08:03 romainpiel

If this is the case, you just need to instanciate a new Kml object (https://github.com/Ekito/Simple-KML/blob/master/SimpleKML/src/com/ekito/simpleKML/model/Kml.java) and build the hierarchy by hand (which is going to be painful :smile: ) Then apply a Serialize.write on that KML object and voila!

romainpiel avatar Mar 14 '13 08:03 romainpiel

Hi! At the beginning I though the same than @brian32768 but later I realised that I could build a Kml object with the characteristics I want, in the same line of your reponse, Romain. I made a few tests changing some of the parameters that I found easy to accede from a Kml object and then serialize it to a Kml file, it works perfect. But I can't find the way to create polygons (not only one). I was exploring the library objects of the Simple-KML and I was searching for a method to add new polygons, actually I though you would use a List type por the object 'Polygon' but I could not understand the structure you design quite well... (I'm a newbie in Java/Android)

By the way, the application's goal is to show the driving characteristics of a person, I mean, if he takes a curve too fast, brakes heavy... I have to represent it in Google Earth through a Kml file. Here is an example:

http://dl.dropbox.com/u/24835373/Example.JPG

It takes the GPS and the accelerometer data and the width of the polygon is related with the transversal accelerometer measures.

In resume, I have all the data I need, and now I have to create the kml file with the multiple polygons, what I'm starting to realise that is going to be hard...

Burakito avatar Mar 14 '13 12:03 Burakito