Keeping all the latitude and longitude decimal places in raw csv after running odkmeta preclean

1. What is the problem? Be very detailed.
I am trying to match households by their gps coordinates from two different datasets. When the surveys are completed, the entire latitude and longitude digits are incorporated, but when I go to clean the data using odkmeta and then odkmeta preclean, the coordinates are either rounded or they are cut off by so many digits. Because they are a shorter amount of digits, each household in the same community have the exact same latitudes and longitudes. This becomes a problem when I want to match another dataset of household latitudes and longitudes to this one. I don't know how to make it so odk can keep the length of the latitudes and longitudes.

2. What app or server are you using and on what device and operating system? Include version numbers.
I am using odk briefcase v 16 and odkmeta v 1.1.0 and stata v 16

3. What you have you tried to fix the problem?
I have gone through the entire odkprelclean searching for the format to manually change but cannot seem to find the right part of code, or if I have to write a section of it. In stata have looked at the format, but the problem is that the raw cvs that odkpreclean spits out already shortens the lat and longs.

4. What steps can we take to reproduce the problem?
I have no idea.

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.
I am using geonear for the stata command to match the nearest coordinates and it works, it just has the same coordinates for all of the households so it matches everything to themselves.

Hi @madslevine, and welcome to the ODK forum! When you have a chance, I'd encourage you to introduce yourself here. Doing so helps build community!

I think the issue here has to do with the type or precision of these variables. My guess is that Stata is importing them as float, but you want them to be double. (For more about the different data types, type help data types in Stata.)

You can indicate to Stata what type to use when importing data (float or double). I believe that by default it is float, but you can change that setting by typing set type double in Stata. Run that command first, then run the odkmeta do-file. (Or add that command near the top of the do-file.) For more information about set type, see the help file on generate.

Hope this helps!

1 Like

Hi @Matthew_White, do you think there could be any other way to keep the digits of the latitude and longitudes? I tried putting this into the odkmeta, and then running the preclean after and it starts having errors with variables because they are no longer the right variable type.

That's interesting; Stata is usually indifferent about whether a variable is float or double. What's the exact error message that you're seeing? Is it the odkmeta do-file that is issuing the error message, or is it a separate do-file that you run after the odkmeta do-file? Also, can you tell what command immediately precedes the error?