Problem with string and constraint for decimal numbers

Hi, guys! I think my problem is similar to what happened here:, but in another fashion.

We have to get geocoordinates. As we are working in a remote place in the Amazon Forest and we don't have phone network, I decided to not use the geo widget from ODK. In this case, as I know in what bounding box we work, I made the following constraint for the field that the researchers might fill:

type: decimal
appearance: numbers
constraint: . >= 2.37 and . <= 7 and string-length(.) = 7

So, in the above example, they have to manually input the coordinates in decimal degrees, including the point.

They have success, as an example, to input a number such as 6.30069 - a decimal number with string length equal to 7 and inside the constraint number.

However, they are not able to input a number such as 6.30070 - which is a number exactly equal to the above, with the exception that it gets a 0 in the end.

I was able to replicate this problem, every time the field is finished by a 0, even if it is apparently encompassed by the constraint, it gives an error.

What am I missing? Could you please help me?

Best regards!


Hi @rdornas

Welcome to the ODK community!

Please see below a comment related to the use of the geo widget in remote locations.

The GPS technology does not require mobile network.
In several project I've worked on we actually used smartphones/tablets without sim cards and the GPS position was correctly recorded. The first recording in each device might take a bit longer (depending on the number of satellites and buildings/trees around the device).

While this does not answer your question, I suggest you try automatically capturing the gps position with your device: not only it will be faster, but it will also minimize enumerators typos.
Hopefully this will work for you!


1 Like

Thank you very much for you answer, Andrea! Your commentary is really helpful because every time I made tests without SIM cards, it took me some precious minutes and the GPS position precision was about 200 m while with SIM card and phone network made it in seconds with excellent precision. But if GPS without phone network takes a little bit longer only in the first recording, maybe I should give it another try.

As we are monitoring roadkilled animals on a railway, our time is precious because we don't have much time until the next train comes. Also, we have to be assured that the precision is really accurate, because we intend to propose mitigation measures. They must be precisely constructed otherwise we are risking advising a measure in the wrong place.

Thank you very much!

My pleasure Rubem.

Depending on whether you have access to reliable power/electricity (which I assume you would if using this system on a train) you might want to leave the GPS sensor on - this way it should stay hooked to several satellites with sufficient accuracy.
Other people in the community might have better suggestions, but a way to do so could be to keep an application running (e.g. Google Maps, or the good old Google Tracks) tracking your actual position. This way you would not need to "warm up" the sensor and it should capture the position immediately.

This is usually not recommended because it would drain the battery pretty fast, but if you can leave it charging while being used it should work well.


Unfortunately this is not how it happens! We inspect the tracks for animals on foot. Nearly 1,000 km in virtually remote places.

I thank you again and I really appreciate your help and interest!