Ability to load locations into the geowidget to guide data collection

We have made good progress on the implementation here. Given the level of interest, we have taken on several of the extensions described above. 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 (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).

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 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.

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.

5 Likes

Nice! Is that a possible feature for Build?

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

1 Like

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/ 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. For example, instance("my-file")/root/item[id=${selected}]/geometry

See a small example: geojson.zip (8.3 KB)

1 Like

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 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. We are currently planning to release the week of August 11th.

2 Likes

Thanks to those who have tried out the beta! I want to draw your attention to some test forms in the beta thread which provide ideas on how to use this feature.

The initial version of this feature is now available in ODK Collect v2022.2.0. We now have documentation for the select from map question type and for attaching a GeoJSON file to a form. :tada:

There are various examples in this post.

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 (+ geojson file) 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. 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. 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 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.

3 Likes

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.

2 Likes

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

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. 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.

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.

:+1: Thanks for briefly describing why you want these, too.

1 Like

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.

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. :+1:

1 Like

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
from here

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.

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.

1 Like

We have released a beta adding functionality to specify a color and character to modify a choice's marker.

This is what it looks like:

Sample form: form.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!

2 Likes

ODK Collect v2022.4.0 is now out and makes it possible to specify a color and/or a symbol for select one from map markers.

3 Likes

ODK Collect v2023.1.0 adds support for specifying lines and polygons/shapes.

This is an example generated from OSM data converted to geojson using this online converter:

form definition, geojson file

More details in the docs!

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

3 Likes

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.