# Ability to load locations into the geowidget to guide data collection

**URL:** <https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406>\
**Category:** Ideas\
**Created:** [June 15, 2020, 8:03pm UTC](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406 "2020-06-15T20:03:36Z")\
**Posts on this page:** 16\
**Page:** 2

<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:** [March 2, 2022, 11:05pm UTC](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/22 "2022-03-02T23:05:39Z")

</div>

We have made good progress on the implementation here. Given the level of interest, we have taken on several of the extensions described [above](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/12). In particular, we are making the `map` appearance work with any `select_one` variant that specifies a `geometry` column. That means you could specify a choice list in the `choices` tab with a `geometry` column or attach a `csv` with a `geometry` column and use those in a select with `map` appearance. **Note that this introduces a new convention** : the `geometry` column is always used to map features when the `map` appearance is used. For the choices tab or a csv, the column value would be points in ODK format (`lat lon alt acc`) and eventually also lines and shapes in ODK format.

Because of the way we built that generalization, properties defined in the geojson file will be accessible in expressions the same way that [values from other datasets are](https://docs.getodk.org/form-datasets/#referencing-values-in-datasets) (I gave a useful example above).

In parallel, @Lindsay_Stevens_Au has added the ability to specify the property to use as the label in the parameters column of the XLSForm (e.g. `label=the_label`) and that just needs to be reviewed ([PR](https://github.com/XLSForm/pyxform/pull/577)).

Given what we've learned during our implementation, **I propose one additional change** : in the case of a select from an external geojson file, defaulting to the `title` property being used as the label. I think we'll want to support styling with the [simple style spec](https://github.com/mapbox/simplestyle-spec/tree/master/1.1.0) sooner than later and so it makes sense to follow it minimally to start with (as opposed to using a `name` property as I'd previously described).

I look forward to any comments on the proposed expansions and changes I've described above. We still have to wire things together and do quality assurance. We hope to have a beta available by the end of the month.

> [@LN](#):
>
> Will get in touch soon.

Had a good conversation with @Ivangayton and @danbjoseph with some ideas on where we could use some geo-related help. In particular, they will look into offline vector tiles.

---

<div class="post-metadata">

**Author:** ![Florian\_May](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/florian_may/32/7758_2.png) [@Florian\_May](https://forum.getodk.org/u/Florian_May)\
**Post date:** [March 3, 2022, 12:41am UTC](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/23 "2022-03-03T00:41:35Z")

</div>

Nice! Is that a possible feature for Build?

> <https://github.com/getodk/build/issues/290>
>
> See https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-g…uide-data-collection/27406/22

---

<div class="post-metadata">

**Author:** ![ahblake](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ahblake/32/22392_2.png) [@ahblake](https://forum.getodk.org/u/ahblake)\
**Post date:** [March 16, 2022, 3:29am UTC](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/24 "2022-03-16T03:29:32Z")

</div>

> [@LN](#):
>
> Given the level of interest, we have taken on several of the extensions described [above](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/12). In particular, we are making the `map` appearance work with any `select_one` variant that specifies a `geometry` column. That means you could specify a choice list in the `choices` tab with a `geometry` column or attach a `csv` with a `geometry` column and use those in a select with `map` appearance.

This is extremely exciting news! I can immediately think of many uses for this.

---

<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:** [March 17, 2022, 10:02pm UTC](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/25 "2022-03-17T22:02:12Z")

</div>

No `map` appearance yet but you can now try your geojson files in v2022.2 Beta 1 to check that we are parsing them correctly. In particular, it should be robust to extra elements.

Any geojson file with `.geojson` extension, a top-level `FeatureCollection` and points only should work. The points should have an `id` property (or top-level `id`) and a `title` property. In an XLSForm, add a question of `select_one_from_file my-file.geojson`. You'll need to use [https://getodk.org/xlsform/](https://getodk.org/xlsform/) or Central v1.4.2+ to convert it. You should see the select in ODK Collect and it should look like a normal select. You should be able to access the `geometry` and any other property [in the usual way](https://docs.getodk.org/form-datasets/#referencing-values-in-datasets). For example, `instance("my-file")/root/item[id=${selected}]/geometry`

See a small example: [geojson.zip](https://forum.getodk.org/uploads/short-url/nWefyUFsEKyjMxbLfUfm0fF8BGf.zip) (8.3 KB)

---

<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:** [April 2, 2022, 2:58am UTC](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/26 "2022-04-02T02:58:17Z")

</div>

Beta 2 is rolling out and includes support for the `map` and `map quick` appearance for `select_one` and `select_one_from_file`! See the post above for a description of how to try it out. There's a sample form with `geojson` above. [This form](https://docs.google.com/spreadsheets/d/1j3COXsYsgA4tX4d922ho19Qm0jn9Xr7NnjxaTc6kJV4/edit#gid=0) is an example of an a select with `map` appearance and a set of locations defined directly in the form.

One thing we are interested in feedback on is performance. If anything feels slow to you, please let us know more about your scenario, the choices you want to load and the basemap you want to use.

More on the beta [here](https://forum.getodk.org/t/odk-collect-v2022-2-beta/36913). We are currently planning to release the week of August 11th.

---

<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:** [April 10, 2022, 4:21pm UTC](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/28 "2022-04-10T16:21:41Z")

</div>

Thanks to those who have tried out the beta! I want to draw your attention to some test forms [in the beta thread](https://forum.getodk.org/t/odk-collect-v2022-2-beta-select-from-map-geojson-datasets/36913/6) which provide ideas on how to use this feature.

---

<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:** [April 18, 2022, 11:07pm UTC](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/29 "2022-04-18T23:07:37Z")

</div>

The initial version of this feature is now available in [ODK Collect v2022.2.0](https://forum.getodk.org/t/odk-collect-v2022-2/37341). We now have documentation for [the select from map question type](https://docs.getodk.org/form-question-types/#select-one-from-map-widget) and for [attaching a GeoJSON file to a form](https://docs.getodk.org/form-datasets/#building-selects-from-geojson-files). 🎉

There are various examples in [this post](https://forum.getodk.org/t/odk-collect-v2022-2-beta-select-from-map-geojson-datasets/36913/6).

Some folks I've talked to have mentioned that the biggest piece missing is status information on device (e.g. I've already visited these places). We hear you! There's no perfect way to do this yet.

[This form](https://docs.google.com/spreadsheets/d/1xsOjYpIX5LXb4Ix98oX96sWU7jISTBVdkboEI9PzagM/edit#gid=0) (+ [geojson file](https://docs.google.com/spreadsheets/d/1xsOjYpIX5LXb4Ix98oX96sWU7jISTBVdkboEI9PzagM/edit#gid=0)) shows two techniques that get pretty close. @Megan_Schroeder @Matt_Berg @Ukang_a_Dickson @Ivangayton

The first involves pulling out the geometry so that the submission will be visible on the [form map](https://docs.getodk.org/collect-form-map/). The form map only looks for `geopoint` questions that are user-visible so I couldn't just use a `calculate`. Instead I put the selection and the pulling of the location in a `field-list`. If you want to pull out the `geometry` for other purposes you may be able to just use a `calculate`.

The second technique that form shows is filtering out locations that have already been visited on the device using [last saved](https://docs.getodk.org/form-logic/#values-from-the-last-saved-record). It has limitations. The state isn't preserved across updates of the form definition. There's no way to "un-visit" a place. But it's pretty close and might work well for some scenarios. This is the same technique discussed in [this thread](https://forum.getodk.org/t/choice-that-was-filtered-out-of-items-to-choose-from-does-not-appear-in-submitted-data/36684) but across submissions rather than repeats.

Please try these new features out and let us know how you're using them and what issues you're running into.

Our tentative next step in this general feature area will be to add support for traces and shapes.

---

<div class="post-metadata">

**Author:** ![ahblake](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ahblake/32/22392_2.png) [@ahblake](https://forum.getodk.org/u/ahblake)\
**Post date:** [June 24, 2022, 7:07am UTC](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/31 "2022-06-24T07:07:28Z")

</div>

> [@LN](#):
>
> Please try these new features out and let us know how you're using them and what issues you're running into.

Finally have been able to come up for air and get around to implementing this new feature (only as internal choices so far, GeoJSON is next)... Works a treat! Thanks to everyone involved!

I'm using location and elevation (I have multiple elevation tilesets for my locations) choice filters to prune the location set down to only those that are at that location-elevation combination

When you select a location and it shows the associated fields, is there a logic to what is displayed and the order? When I use internal choices, it shows the `label` as the title, and then the rest of the fields below the save icon, but not in column L-R or alphabetical A-Z order. Also doesn't appear to be datatype or length.

Ideally I'd be able to force the order / select which are shown, but I think the correct answer is to only populate `name label geometry` plus my desired fields to be shown and then use the selected `name` as the index to lookup anything else I want to show / use as dynamic defaults etc.

Trace and shape support would be **really really good** , as I could skip creating/calculating a centroid for these and show them as is on the map select. And any ability to colour the pins would be super useful as an enumerator guide for different types/ranks.

---

<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:** [June 24, 2022, 4:08pm UTC](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/32 "2022-06-24T16:08:10Z")

</div>

Thanks so much for coming back to give feedback, @ahblake! We're thrilled to hear this is helpful to you.

> [@ahblake](#):
>
> When you select a location and it shows the associated fields, is there a logic to what is displayed and the order?

If you use GeoJSON or an external CSV, they appear in the order that they have in the source file. For internal choices, as far as I know, `pyxform` orders them alphabetically by node name and it shouldn't: [https://github.com/XLSForm/pyxform/issues/602](https://github.com/XLSForm/pyxform/issues/602). If you have a case where the order seems entirely unpredictable that might be something to consider sending us so we can look at it.

> [@ahblake](#):
>
> only populate `name label geometry` plus my desired fields to be shown and then use the selected `name` as the index to lookup anything else

That is a fine solution. It may be less performant and if you do hit a scale where you're running into performance issues, please let us know the item count and the device you're using.

> [@ahblake](#):
>
> Trace and shape support would be **really really good**... And any ability to colour the pins

👍 Thanks for briefly describing why you want these, too.

---

<div class="post-metadata">

**Author:** ![ahblake](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ahblake/32/22392_2.png) [@ahblake](https://forum.getodk.org/u/ahblake)\
**Post date:** [June 25, 2022, 6:33am UTC](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/33 "2022-06-25T06:33:29Z")

</div>

> [@LN](#):
>
> Thanks so much for coming back

Have been distracted with non ODK fun things recently, but back at it now!

My current use case is to manually apply point values to existing known anomalies to help guide the enumerator to their location, select it to see details/confirm choice and then update the condition.

Later in the form updated/new anomalies are capturing shape &/or line &/or point information, so in the next cycle, being able to show those in their captured form will be better than a single point.

> [@LN](#):
>
> For internal choices, as far as I know, `pyxform` orders them alphabetically by node name and it shouldn't

aha! I see now, I had some mixed capitalisation (labels and acronyms), so it was sorted, but it was A-Za-z - confirmed by adding some test labels just then.

Good to know I can use the order in GeoJSON/CSV or just force the order with creative column titles until the bug is fixed.

The 'jump to extent of points' button is also really useful to zoom to the view of all filtered points. 👍

---

<div class="post-metadata">

**Author:** ![ahblake](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ahblake/32/22392_2.png) [@ahblake](https://forum.getodk.org/u/ahblake)\
**Post date:** [June 28, 2022, 1:37am UTC](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/34 "2022-06-28T01:37:39Z")

</div>

> [@LN](#):
>
> what issues you're running into.

Something I thought of and only just tested; If points have identical coordinates, then only one (the first in the choice list) of those is able to be selected in the Collect `map` appearance, but all are visible for selection in the `select_one` Enketo appearance.

What I haven't yet tested is how close items can be before they become indistinguishable for selection at the max zoom levels that the different base layers allow (I only use mapbox as the others are too limited), i.e. is this actually a problem that requires solving - are multiple selections with identical/near identical coordinates a valid use case?

The expected behaviour I'd imagine is some sort of clustering where you select the cluster and it expands to show all points at those coordinates like this:

![image](https://getodk.b-cdn.net/uploads/default/original/3X/9/a/9a08f0f438edc50463a2d16a13f37a6f5ee908d0.png)  
[from here](https://tomik23.github.io/leaflet-examples/#26.markers-60K)

---

<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:** [July 14, 2022, 9:56pm UTC](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/35 "2022-07-14T21:56:49Z")

</div>

> [@ahblake](#):
>
> The expected behaviour I'd imagine

That's very nice indeed! We do have hopes to eventually add clustering for large sets of features but don't have an ETA for it yet.

> [@ahblake](#):
>
> are multiple selections with identical/near identical coordinates a valid use case?

My guess based on usage patterns I've heard about so far is that this would be rare. What I'd recommend in that case is to have a follow-on question to disambiguate based on label in case of an exact match (or maybe match truncated to some number of decimal points). You can use the `count` function to calculate how many matches there are (e.g. `count(instance('features')/root/item[geometry=${selected}])`) and use that in a relevance expression for the select. Then the select can be on the same list and have a choice filter of `geometry=${selected}` to only include features with matching geometry.

---

<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:** [September 28, 2022, 6:05pm UTC](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/36 "2022-09-28T18:05:59Z")

</div>

We have [released a beta](https://forum.getodk.org/t/39122) adding functionality to specify a color and character to modify a choice's marker.

This is what it looks like:

 ![Screen Shot 2022-09-28 at 10.59.44 AM](https://getodk.b-cdn.net/uploads/default/original/3X/6/5/65e2461c639f71907a07862189876bce0a67f165.png)

Sample form: [form.zip](https://forum.getodk.org/uploads/short-url/k4XkHmT32kPYPfAhodlGtrOeO9b.zip) (7.6 KB)

- `marker-color` is the name to use as a GeoJSON property or choice list column to specify a color for a choice's marker. Any hex color is allowed.

- `marker-symbol` is the name to use as a GeoJSON property or choice list column to specify a symbol for a choice's marker. Any single unicode character is allowed.

Let us know what you think!

---

<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:** [November 23, 2022, 10:52pm UTC](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/37 "2022-11-23T22:52:25Z")

</div>

[ODK Collect v2022.4.0](https://forum.getodk.org/t/odk-collect-v2022-4/39679) is now out and makes it possible to specify a color and/or a symbol for select one from map markers.

---

<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:** [April 18, 2023, 6:21pm UTC](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/39 "2023-04-18T18:21:47Z")

</div>

[ODK Collect v2023.1.0](https://forum.getodk.org/t/odk-collect-v2023-1/40930) adds support for specifying lines and polygons/shapes.

This is an example generated from OSM data converted to geojson using [this online converter](https://mygeodata.cloud/converter/osm-to-geojson):

 ![select-from-map-polygon](https://getodk.b-cdn.net/uploads/default/original/3X/2/a/2ad9439e69f6e52012d828cf147f18c604bca9ba.png)

[form definition](https://docs.google.com/spreadsheets/d/1fnPO_CZ88faOalTRjFrYUG9pQazWGWoatDkeoc4UiCk/edit#gid=0), [geojson file](https://drive.google.com/file/d/1kmNUz6hgreVQl64b9rRfNYXYLPWttwl2/view?usp=share_link)

More details in [the docs](https://docs.getodk.org/form-question-types/#select-one-from-map-widget)!

Thanks again to everyone who made this whole big area of functionality come together over time.

---

<div class="post-metadata">

**Author:** ![Nguyen\_Van\_Thanh](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/nguyen_van_thanh/32/24102_2.png) [@Nguyen\_Van\_Thanh](https://forum.getodk.org/u/Nguyen_Van_Thanh)\
**Post date:** [January 5, 2024, 5:47am UTC](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406/40 "2024-01-05T05:47:02Z")

</div>

Thank you all ODK team for your great development.

I wonder if we can have a way to show different colors for the polygons shown on the ODK Collect, something like 'marker-color' for Point type.

I read the document, but it says:

> There are two special properties that can be used to style the marker for a Point choice

However my concern is for Polygon...

Additionally, I am not able to edit the polygons. Ways I tried:

> instance('zoo')/root/item[id=${zoo\_building}]/geometry

This way show error in Collect;

> instance('zoo')/root/item[id=${zoo\_building}]/shapestring

This does not generate an error, but emty data.

Please help!!!  
Thank you very much in advance.

[Previous page](https://forum.getodk.org/t/ability-to-load-locations-into-the-geowidget-to-guide-data-collection/27406.md?page=1)
