Example for preloading points on a map

Hello,

I have upgraded the ODK Collect app to the latest version and trying to use the new feature for selecting predefined points from a map.

The Aggregator I am using doesn't support the upload of geojson files so I was thinking of storing the locations in a CSV. Although I have build forms using CSV files in the past, I am not sure how to do it for displaying the locations on a map from the CSV.
Also, I understand that the new feature gives the option to click on the point and add/edit the parameters.
Is there an example on how to do this?

Thank you.

1 Like

See https://docs.getodk.org/form-question-types#select-one-from-map-widget for the documentation.

ODK Collect v2022.2 Beta: select from map, geojson datasets - #6 by LN also has some sample forms.

2 Likes

Thank you @yanokwa.

I have used one of the examples from the second link and it works well. However, I still have not managed to make it work with CSV.
I share here both the CSV and the xls form. For some reason, the points from the CSV are not displayed on the map. But I am not sure I "connect" the two files correctly.

aleppo_meskaneh_crop_yields.xlsx (19.5 KB)
locations.csv (127 Bytes)

You're using the search() appearance/function which does not support the map appearance (and is generally undocumented).

If you want to use an external CSV, you can use select_one_from_file which works the same way as internal selects.

Your file as attached only has a single column in addition to geometry. You'll need to specify that you want it used for both the label and the underlying value. You do this by putting label=name_t, value=name_t in the parameters column. Read documentation.

aleppo_meskaneh_crop_yields.xlsx (18.4 KB)

There isn't yet a built-in way to update your dataset (e.g. your CSV file). You can do things like pull values out of the dataset to use as defaults for form questions. You can also have the form capture new data about the location. Then you can use submissions to update your dataset manually or through a script. Look at the examples @yanokwa linked to and please ask if you have additional questions.

1 Like

Thank you very much @LN

When I try to upload the form I get the below error, which is related with the values in the Parameters column. Would you know why this is happening? Can it be related with the version of my agreggator?

image

MoDa, I believe, is a version of Ona Data + RapidPro that WFP, uses? Looks like it needs an update.

1 Like

I see. @yanokwa. Thank you very much. For now, as a workaround, I will load all the locations in the XLS form.

1 Like