Tool to save geo trace and area as KML for mapping

Hi Nikhil,

I just discovered that if I upload the generated KML file into Google Maps - it works perfectly, so yes, actually the app works fine thanks :slight_smile: However, when i open the KML in Google Earth on my computer - it doesn't show me the path. Strange.

The 2 geopoints I sent in the last one were from geotrace "auto" collect at 1 second intervals, so I guess or data collector was standing still for a moment!

Update!

Actually, the problem was one of the traces - someone started recording before having location locked, and so the trace started somewhere in West Africa before localizing in the Philippines...

3 Likes

Ah! It was precisely this reason why i built the tool.. To spot faulty recordings quickly :slight_smile:

2 Likes

Because I know absolutely nothing about how this works - would there be any way to automate your script such that a trace "live" published via aggregate to a cell in Google Sheets is automatically processed, generates and saves a KML file, and includes a link to that file in a new column (or a new google sheet with UUID of source data in column A, link to KML in column B)?

I am trying to find the most end-user friendly way for using and presenting geotrace data. If we can avoid the step of someone having to manually generate each KML file that would be wonderful!

@philjones a macro/script in google spreadsheets could be created to do it. I'm not well-versed with that bit of tech yet.

1 Like

Update : fixed some problems in the live script , mostly to handle unclean data properly. Should work better now.

Fence is great, I've tried it with your data and the line is perfect, but when using my odk collect data it does not show me anything, then an example.
12.52942603 -87.04165634 0.0 0.0; 12.52947502 -87.04171918 0.0 0.0

Another thing, how could you calculate the distance of those 2 points, even if it is not visual, only the value in meters.
Thanks in advance, greetings.

Hi @famador, answering your second question first: A "haversine distance formula" is the de-facto one used to calculate distances. There's quite some theory about it given on this page: https://www.movable-type.co.uk/scripts/latlong.html

Searching the net for "lat long distance calculator" throws up many results - online tools where you can paste in your values and find the distance.

Coming back to the first query : I was able to properly make a KML of the sample data you provide, using the same script. (it's just two locations so just makes a line) Their location is somewhere in the middle of the ocean.

FYI you might be interested in this thread with an in-form solution for converting a 'fence' (geoshape or geotrace) to KML.

how could you calculate the distance of those 2 points

If you have two geopoints, eg in a geotrace, you can use the build-in ODK function distance() to get their distance. These dont actually have to come from a geotrace question per se; eg if you have two separate geopoint questions you can still do it; see this thread for description.

Hi. I have this string of coordinates: -23.393592692 -57.319247895 146.24861145 3.1661; -23.39289479 -57.31873217 152.062393188 4.7; -23.393306373 -57.317805633 147.981460571 4.791231; -23.393979817 -57.318308804 141.856079102 4.7; -23.394075003 -57.318732476 133.329360962 4.7; -23.39358052 -57.319298762 151.696716309 4.9; -23.393592692 -57.319247895 146.24861145 3.1661
The script does not recognize the minus sign (-), how can this be solved?

Hi @Marcelo_Raul_SCARONE, thanks for pointing out this bug. I had been zapping minus signs too at the data-cleaning stage. I've corrected my script - please give it a spin again.

Your sample data is a field in Paraguay if my script is getting it right.

2 Likes

Hi. Now it works well. Yes, those coordinates correspond to Paraguay. Sorry for my bad English.
Question: This script allows to make several polygons? That is, I have several coordinate chains, of different polygons, I can only convert them one by one?

Hi @Marcelo_Raul_SCARONE, of course, that's what I made it for :slight_smile: Just copy-paste your entire column into the box. Every line will be converted into a separate polygon / line in the output KML.

1 Like

That would be great! I'll try it later. I'll let you know if it works out for me. I have hundreds of data that I'd like to turn into polygons

1 Like

Hi, don't you have any script to convert a geopoint to kml? I don't know how to do it, I've tried in a csv file separating the data into columns so that one column is latitude and the other longitude, but I can't import into google earth.

By default, the sript assigns each line with the corresponding number of shape, being "shape 1", "shape 2", "shape N" ...
It may be a lot to ask, but could you link each line with its corresponding identifier column?

Hi, I've moved my script to a github repo of its own, so that it's easier to propose changes, do pull requests etc. You can find the new link here: https://answerquest.github.io/ODKgeotrace2shapefile/ , and the code here.

1 Like

Hi @Nikhil_VJ,

Sorry to read this thread lately but that showcase would be helpful :

Hello. This script names each line "shape 1", "shape 2", "shape ... N" by default. Is it possible to change this and specifically select an Excel column to name each line? In my case, each line is a polygon of a maize crop that belongs to different farmers. I'd like the farmer's name to appear instead of "shape." Is this possible to do?

This is exactly what I need!