Filter choices to those near my current location

Does anyone have an example of this being done yet?

In my case I have a CSV with a list of trees and their GPS points and I would want a selects question that uses a choice filter to show which trees that are within 10 meters or less of the current gps location that could be a previous question using a geopoint. Surely someone has done this by now and I don't need to reinvent the wheel right...? Right?

1 Like

You can use the distance function in a choice_filter on a select_one to only show choices that are within 10 meters of a previously selected current_location.

distance(geometry, ${current_location}) < 10

There is a sample form at the bottom of the distance documentation that shows this and more.

2 Likes

@yanokwa @Tyler_Depke I am trying to do something similar but having difficulty getting the GPS coordinates listed in my csv to show up on a map to select from in my ODK form. How do GPS coordinates need to be formatted in my CSV?

The docs that @yanokwa links to have an example form, which has some example coordinates in the choices sheet.

You could also create a form with geo questions and then calculate the result into a text question to see the value.

Depending on your existing data format you can almost certainly transform it, eg with virtual fields in QGIS

1 Like