Universal transverse mercator (UTM)

geotrace
#1

Hi All,
I suggest to create a feature of 2 dimensional map called UTM which is used by some international and national organisation.

Kobo has already the GPS but does not have universal transverse mercator (UTM) when collecting data in the field.
in my last works, our clients requested to find the location through UTM not GPS. So, it will be a problem for us to convert GPS to UTM and takes time.
This feature helps us to find the distance between 2 or 3 location and putting all locations on the map.

Regards,
Delshad Botani

#2

Please note, ignoring other benefits of UTM, if you just wish to calculate the distance between locations you can do so with existing GPS encoded geopoints, or equivalently a geotrace with the 2 endpoints, using the existing ODK XPath distance() function. See https://docs.opendatakit.org/form-operators-functions/#geography

#3

Dear Dr. Gareth,
thanks alot for your suggestion. I know that there is geotrace, but I am in need of to know the distance between 2 points in meters. Using GPS could not help to find the distance in meters. I think, Kobo can create a feature for transforming from GPS to UTM system and it is very simple for them.

Regards,
Delshad

#4

If you construct a geotrace with your two (geo)points, then you can use the distance() function to get the distance between them. Try loading this form into https://opendatakit.org/xlsform/ and having a play around:

gpsdistance.xls (5.5 KB)

A geotrace result is actually just a string containing two (or more) geopoints with a ‘;’ separator. eg

-40.450013 175.839731 0 0;-40.22512 175.567674 0 0

which - as I’ve done in the above form - you can easily construct yourself using the concat() function.

geotrace: calculation = concat(${geopoint1}, ';', ${geopoint2})

And if instead you are starting with raw GPS latitude and longitude values, you can similarly construct a geopoint (to use above) using concat() and space separators; eg

geopoint1: calculation = concat(${latitude}, ' ', ${longitude}, ' 0 0')

[distance() ignores altitude and accuracy so I’ve set both to both 0]

2 Likes
#5

Although converting a GPS (or geopoint) to UTM is technically possibly, it is not a simple calculation - eg see https://github.com/hobu/mgrs/blob/master/libmgrs/utm.c:Convert_Geodetic_To_UTM() for an algorithm. As such, it would likely have to be implemented as a new XPath function in javaRosa/ODK Collect, before being picked up it KoboCollect. And, if the compelling usecase for adding such a new function is calculating distances - which can already be accomplished via the existing distance() function - then it probably wont be given a high priority by the ODK development team.

1 Like
#6

Dear Dr. Gareth,
Thanks alot for your excellent help with this issue, really I did not have information about distance function.
Last thing, I had a look on the site which you sent me “https://github.com/hobu/mgrs/blob/master/libmgrs/utm.c:Convert_Geodetic_To_UTM()
There are C++ code and Matlab, I have no idea about them.
If the client wants me to find UTMs instead of GPS, what I do? They do not want distances just.
I can go to an online website and convert the locations to UTM, But is there any way to do that inside odk or Kob?

Best Regards,
Delshad Botani

#7

Sorry, that should have been: https://github.com/hobu/mgrs/blob/master/libmgrs/utm.c Convert_Geodetic_To_UTM()

XForms does support pretty much a full suite of mathematical and trig functions - see https://docs.opendatakit.org/form-operators-functions/#math
So if you can find a suitable algorithm for performing a GPS lat+long to UTM conversion, it should be possible to implement a suitable set of calculations within your form to generate a UTM result. (eg I’ve done this for converting geopoint/geoshape/geotrace to KML). So yes, its quite likely possible to ‘do that inside odk or Kob’, it just may be a bit tricky. :slight_smile:

1 Like
#8

Dear Dr. Gareth,
Thanks alot for your cooperation and helping me too much.
Regards,
Delshad Botani