Change geotrace coordinate format into kml format

Hi all,

As you all know the geotrace format is something like this: 31.0017161 2.90287306 0.0 0.0; etc. Anyone managed or tried to use a calculation expression to a transform this format to a kml format (""Polygon>LinearRing>coordinates>31.229187,1.382221,0.0 31.229353,1.382059,0.0 31.229507,1.382101,0.0 31.229304,1.382285,0.0 31.229187,1.382221,0.0</coordinates</outerBoundaryIs</Polygon"") If not, could it be possible? For example by carrying out a search on ";" and/or barspaces and from that erase some numbers and to create a clean "31.0017161 2.90287306" format and then add the info that is needed for kml? Just curious if this could work. This would be great because you could read the polygons directly into Google Fusion. Thanks for any ideas or feedback on this.

This conversion is certainly possible, and wouldn't be too hard to script.

Alternatively, you can probably use a combination of existing available tools to accomplish the desired result; eg

geotrace to shapefile
shapefile to KML

Have a go and post back if it works! :slight_smile:

Hi Gareth,

I don't have an IT background neither profound scripting experience. My hope was that it is possible with a combination of calculations (so using a few calculation expressions) such as 'truncate' etc within excel and than convert it. If this is possible (in excel) and if someone could direct me into the right direction (expressions to use) I can give it a try. But my first inventory is to find our if there are enough expressions possible (with a calculate field in excel) to do all kind of transformations... If so, I can try it. Aggregate with Google Fusion works perfect and it would be even greater if I can also show polygons on the fly without having them to transform manually and then upload them to G.Fusion...

It would be possible to write a XSLForm calculation to convert a single geopoint to its equivalent KML <coordinate>. However, there is not the means to process the arbitrarily long list of geopoints in a geotrace/geoshape to a suitable formatted LineString (aka geotrace) or LinearRing (aka geoshape) using a (XPath) string calculation. To do so would probably require either writing a custom Collect widget that outputs KML-formatted GIS objects, or writing a custom XPath function for Collect/javaRosa that does the translation. That is, both will require development $work.

You might want to ask around in the GeoODK forum; I imagine this sort of thing has come up before.

BTW, are we talking ODK1 or ODK2 here? (my previous response is wrt ODK1)