Can I create a new geopoint from calculated lat/lon data?

1822
5
Jump to solution
04-07-2018 04:54 PM
TiffanySprague
New Contributor III

I've developed an XLSForm to calculate coordinates for a remote location using the current location, bearing, and distance. Can I use the calculated coordinates for the remote location to create a new geopoint that will display on a map? I've tried calculating the new geopoint using concat(${remote_lat},',',${remote_lon}) but get an error message.

Is what I'm trying to do simply not supported?

Thanks for any help.

0 Kudos
1 Solution

Accepted Solutions
JohnMarra
New Contributor III

Try

concat(${remote_lat},' ',${remote_lon})

View solution in original post

5 Replies
JohnMarra
New Contributor III

Try

concat(${remote_lat},' ',${remote_lon})

TiffanySprague
New Contributor III

Excellent! That simple change did it. Thanks very much.

I have another question related to the same survey. I originally did all the intermediate calculations as "calculate" types, but kept getting errors in calculating the remote longitude - which depends on the remote latitude among other things. (I'm using Haversine's formula.) I set all the calculations as double-length floating point. When I started displaying all the intermediate results, changing the "calculate" types to "decimal" types, things work. I didn't change the field types; they're all still double floating point.

I suspect this has something to do with the default format for calculate versus decimal. Can somebody please explain this to me so I don't have to display a bunch of intermediate results?

BTW, the error in the longitude calculation was that two separate calculations seemed to be directly concatenated, so a longitude (in radians) that I expected to be, e.g., "-1.123....89" would be displayed as "-1.123....891.00234..78".

0 Kudos
JohnMarra
New Contributor III

I have the same issue with calculate field, it believe it has to do with survey123 spitting out the result of the calculate fields as text. Instead of changing the bind::type to double or integer, try using the number() function. So after a calculate field if the next field were to be an actual visible field (geopoint,decimal, whatever), you would use something like number(${calculate_lat}) instead of simply ${calculate_lat} in the calculation column.

TiffanySprague
New Contributor III

That also worked, John, with a little experimentation. Not only did I use 'number()' with calculated expressions to be displayed visibly, I also had to use it in a calculate field on a previously-calculated result that was outside a trig function (e.g. on "a" in "a + sin b"). Previously-calculated results inside trig functions seemed to work okay without modification.

I really appreciate your suggestions. We're a small conservancy trying to use Survey123 for field data collection, so everything we do is a learning experience!

Thank you.

erkin_huseinov
New Contributor

can you share xlsx for testing

0 Kudos