# Collection of georeferenced data with return of fields from csv files

**URL:** <https://forum.getodk.org/t/collection-of-georeferenced-data-with-return-of-fields-from-csv-files/40164>\
**Category:** Support\
**Tags:** odk-collect\
**Created:** [January 17, 2023, 8:09pm UTC](https://forum.getodk.org/t/collection-of-georeferenced-data-with-return-of-fields-from-csv-files/40164 "2023-01-17T20:09:56Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![giulia\_tomasi](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/giulia_tomasi/32/19534_2.png) [@giulia\_tomasi](https://forum.getodk.org/u/giulia_tomasi)\
**Post date:** [January 17, 2023, 8:09pm UTC](https://forum.getodk.org/t/collection-of-georeferenced-data-with-return-of-fields-from-csv-files/40164/1 "2023-01-17T20:09:56Z")

</div>

The appetite comes with eating. Thank you all for the support! Unfortunately I'm a new entry and I have certain computer limitations. I  
[FORM\_CFTCFV\_ver.xlsx](https://forum.getodk.org/uploads/short-url/rn0SRFXDgBqmV6sr8quvqrbLx37.xlsx) (155.7 KB)  
[elebuchit (1).csv](https://forum.getodk.org/uploads/short-url/nV7RTqzEDwdDLXwCUjypyo8DT4h.csv) (2.2 MB)  
take care of detecting plant species in a given area and I have several volunteer collaborators to pass the form to when it is ready. I have already achieved a good result thanks to your help. But I would like to optimize it if possible. I'll explain how. In each repetition of species detection I take the punctual coordinates with geopoint. Through these I would like the code of the quadrant in which I am at the moment of the survey to appear (See georeferenced file quadr\_TN. In the longitude and latitude section I have extracted the values ​​of the centroids of each quadrant). The final goal is the automatic compilation of the check field of the form through the elebuchit.csv file where the same species present in the chose sheet of the form and the quadrant code of quadr\_TN are listed. I am aware that it is not easy but I am counting on the help of some genius! I enclose everything and I hope to be an incentive for others  
[quadr\_TN.csv](https://forum.getodk.org/uploads/short-url/sodZl4RWlcOS8Uf0FW8bjbe03F3.csv) (25.7 KB)

[https://drive.google.com/drive/folders/1AvaB2z2y8r11ZQjRi4xRvdM3cz-9CusO?usp=share\_link](https://drive.google.com/drive/folders/1AvaB2z2y8r11ZQjRi4xRvdM3cz-9CusO?usp=share_link)

---

<div class="post-metadata">

**Author:** ![mathieubossaert](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/mathieubossaert/32/6131_2.png) [@mathieubossaert](https://forum.getodk.org/u/mathieubossaert)\
**Post date:** [January 20, 2023, 9:32am UTC](https://forum.getodk.org/t/collection-of-georeferenced-data-with-return-of-fields-from-csv-files/40164/2 "2023-01-20T09:32:50Z")

</div>

Hi @giulia_tomasi

let me say what I understand and tell me if I am wrong :

You get a gepoint and you want to calculate the name of the quadrant in wich the point is located ?

---

<div class="post-metadata">

**Author:** ![giulia\_tomasi](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/giulia_tomasi/32/19534_2.png) [@giulia\_tomasi](https://forum.getodk.org/u/giulia_tomasi)\
**Post date:** [January 20, 2023, 1:25pm UTC](https://forum.getodk.org/t/collection-of-georeferenced-data-with-return-of-fields-from-csv-files/40164/3 "2023-01-20T13:25:21Z")

</div>

yes, exact! the grid of the dials is this:

[https://drive.google.com/drive/u/1/folders/1AvaB2z2y8r11ZQjRi4xRvdM3cz-9CusO](https://drive.google.com/drive/u/1/folders/1AvaB2z2y8r11ZQjRi4xRvdM3cz-9CusO)

---

<div class="post-metadata">

**Author:** ![mathieubossaert](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/mathieubossaert/32/6131_2.png) [@mathieubossaert](https://forum.getodk.org/u/mathieubossaert)\
**Post date:** [January 20, 2023, 1:34pm UTC](https://forum.getodk.org/t/collection-of-georeferenced-data-with-return-of-fields-from-csv-files/40164/4 "2023-01-20T13:34:45Z")

</div>

Imagine if the user could select the quadrant on a map at the beginning of the form using his GPS? Would this be a solution?  
I'm thinking about the **select\_one** question with the **map** appearance that will soon work for polygons and lines...

---

<div class="post-metadata">

**Author:** ![giulia\_tomasi](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/giulia_tomasi/32/19534_2.png) [@giulia\_tomasi](https://forum.getodk.org/u/giulia_tomasi)\
**Post date:** [January 20, 2023, 3:48pm UTC](https://forum.getodk.org/t/collection-of-georeferenced-data-with-return-of-fields-from-csv-files/40164/5 "2023-01-20T15:48:24Z")

</div>

it could be a good solution. Thanks for your interest

---

<div class="post-metadata">

**Author:** ![mathieubossaert](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/mathieubossaert/32/6131_2.png) [@mathieubossaert](https://forum.getodk.org/u/mathieubossaert)\
**Post date:** [January 21, 2023, 9:02am UTC](https://forum.getodk.org/t/collection-of-georeferenced-data-with-return-of-fields-from-csv-files/40164/6 "2023-01-21T09:02:46Z")

</div>

This feature will soon be available (using lines and polygon in select\_one's map appearance)  
You can right now test it in you form using the centroïd of your quadrants. And imagine what it will be when replacing the point definition in the polygon one.

Here I used the choices sheet and added a geometry column to put the point definition in ODK's standard. And set choice\_filter to true() in order to show all the points on the map.  
You can use external csv or geojson instead.  
[FORM\_CFTCFV\_ver.xlsx](https://forum.getodk.org/uploads/short-url/2wlJPrwcTEbCLZKW1Qvnw9mFAa2.xlsx) (132,6 Ko)

 ![Screenshot_20230121-094916](https://getodk.b-cdn.net/uploads/default/original/3X/f/2/f2c722474b2395e9280a9be8ccea9a706df5ccf2.jpeg)

---

<div class="post-metadata">

**Author:** ![giulia\_tomasi](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/giulia_tomasi/32/19534_2.png) [@giulia\_tomasi](https://forum.getodk.org/u/giulia_tomasi)\
**Post date:** [January 21, 2023, 1:42pm UTC](https://forum.getodk.org/t/collection-of-georeferenced-data-with-return-of-fields-from-csv-files/40164/7 "2023-01-21T13:42:46Z")

</div>

thanks, i tried and it's already a fantastic result also with centroids! let alone when the function with polygons will be ready! I can not wait! How do I stay informed? Will it be posted on this forum? Thanks again. Can I ask instead how to use external csv or geojson invede of the choice sheet? sorry but I'm still a beginner. Thank you very much!

---

<div class="post-metadata">

**Author:** ![mathieubossaert](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/mathieubossaert/32/6131_2.png) [@mathieubossaert](https://forum.getodk.org/u/mathieubossaert)\
**Post date:** [January 21, 2023, 5:51pm UTC](https://forum.getodk.org/t/collection-of-georeferenced-data-with-return-of-fields-from-csv-files/40164/8 "2023-01-21T17:51:17Z")

</div>

This is well documented in the doc :

> **[Question Types](https://docs.getodk.org/form-question-types/#select-one-from-map-widget)**
>
> ODK Collect supports forms with a wide variety of question types. The exact functionality and display style of each question are specified in your XLSForm definition using the type and appearance c...

And this thread is also a good resource :

> [@ODK Collect v2022.2 Beta: select from map, geojson datasets](https://forum.getodk.org/t/odk-collect-v2022-2-beta-select-from-map-geojson-datasets/36913):
>
> ODK Collect betas are an opportunity to get community feedback on upcoming releases. If you have an ongoing data collection campaign, we recommend quickly verifying your form on a test device. The release will be delayed until all reported issues are fixed. Joining the beta program To join the beta program, find ODK Collect in the Play Store on your device (not in the web browser) and scroll all the way down. Please don't join the beta with a device or account actively used for data collection…

Yes new releases and their new functionalities are introduce to the community by the team on the forum.

---

<div class="post-metadata">

**Author:** ![giulia\_tomasi](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/giulia_tomasi/32/19534_2.png) [@giulia\_tomasi](https://forum.getodk.org/u/giulia_tomasi)\
**Post date:** [January 23, 2023, 8:17pm UTC](https://forum.getodk.org/t/collection-of-georeferenced-data-with-return-of-fields-from-csv-files/40164/9 "2023-01-23T20:17:00Z")

</div>

thanks very interesting. To resolve the boundaries of the quadrants I loaded a MBTiles map with the boundaries that I saved in my smartphone and it works! It is called as a layer in the above google map. Through select one I now obtain the quadrant for each species entered. As a last step I would need to check each repetition through the csv file that I attach. For example: If I enter "Abies alba" in quadrant 9432/3 I would like a "check" field that returns the value "4" in the form. If I enter "Abutilon theophrasti" in the box " I would like "0" to appear (see first two lines of the csv file)  
[buchiTN.csv](https://forum.getodk.org/uploads/short-url/zwfTw4aCsNqgXXFWU06oSWbWF07.csv) (2.2 MB)

---

<div class="post-metadata">

**Author:** ![mathieubossaert](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/mathieubossaert/32/6131_2.png) [@mathieubossaert](https://forum.getodk.org/u/mathieubossaert)\
**Post date:** [January 26, 2023, 1:50pm UTC](https://forum.getodk.org/t/collection-of-georeferenced-data-with-return-of-fields-from-csv-files/40164/10 "2023-01-26T13:50:43Z")

</div>

Hi Giulia,

this is really close to some of our scenarios and needs for biodiversity relative forms.  
I achieved to do what you expected for a water level monitoring form (showing the expected value at the day of visit for the selected place) but with really less column (1 per month). I wrote a logical test to get every value (one per month) and show the good one to the user :

> [@Get custom data from choices sheet for calculation](https://forum.getodk.org/t/get-custom-data-from-choices-sheet-for-calculation/13608/3):
>
> Sorry to zombify this topic, but I am not able to achieve this. I would like to get a value from a column of a list in the choices sheet (not from a extarnal csv file) and I can't. I get no error, no value. I would like to get, from the "stations" list the value of the column "month\_03" for tech selected item. In the calculation column of my calculate field I have this xpath expression : instance('stations')/root/item[name=${station}]/month\_03

In your case you have too much columns to use that way.  
(let's say we rename the quadrant and column to avoid forbidden characters so 9432/3 becomes \_9432\_3)  
this calculation will work and return the value **4** for _Abies alba_ :

> instance('Species')/root/item[name=${species}]/\_9432\_3

At the time I created my form, I did not thought about using a question name to access the wanted attribute.  
I tried with your form but it seems to not be possible.

> instance('Species')/root/item[name=${species}]/${quadrant}

This syntax does not work and does not rise any error (so I think ODK is looking for a column named '_ **${quadrant}** _' that does not exists. Maybe xlsforms gurus (@LN , @Xiphware and others) can complete or correct my understandings 😉

This would be really helpful and practical indeed, at least from a theoretical point of view 🙂

---

<div class="post-metadata">

**Author:** ![LN](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ln/32/1605_2.png) [@LN](https://forum.getodk.org/u/LN)\
**Post date:** [January 26, 2023, 8:43pm UTC](https://forum.getodk.org/t/collection-of-georeferenced-data-with-return-of-fields-from-csv-files/40164/11 "2023-01-26T20:43:25Z")

</div>

> [@mathieubossaert](#):
>
> I think ODK is looking for a column named '_ **${quadrant}** _' that does not exists

Yes, that's correct. To do what you would like, I think we'd need to support something like:

```xml
instance('Species')/root/item[name=${species}]/*[local-name()=${quadrant}]

```

---

<div class="post-metadata">

**Author:** ![giulia\_tomasi](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/giulia_tomasi/32/19534_2.png) [@giulia\_tomasi](https://forum.getodk.org/u/giulia_tomasi)\
**Post date:** [January 27, 2023, 11:00pm UTC](https://forum.getodk.org/t/collection-of-georeferenced-data-with-return-of-fields-from-csv-files/40164/12 "2023-01-27T23:00:14Z")

</div>

Thanks, I tried to follow mathieubossaert's example but I don't know why I don't get the value 4 for the indicated species and dial even if I transformed the dials into allowed characters as suggested. I'm probably still doing something wrong that I don't understand. If you want, I'll reattach the updated files. I think I place the csv correctly in the "buco da-media" folder.  
Thank you  
[buco\_da.xlsx](https://forum.getodk.org/uploads/short-url/oLWY1ohv98p6u39FOP6emJphX4R.xlsx) (1.3 MB)  
[BuchiTN.csv](https://forum.getodk.org/uploads/short-url/nr8zZVfO3s6is5racZMO9xb03sh.csv) (2.2 MB)
