Set color to polygons/geoshapes - select_one from map choice

1. What is the issue? Please be detailed.
https://docs.getodk.org/form-question-types/#select-one-from-map-widget

This feature works very well to display points and geoshapes.
Color coding and symbols are possible for points.
Anyone tried assigning color geoshapes?
also remove those points on geoshape boundaries.

2. What steps can we take to reproduce this issue?

3. What have you tried to fix the issue?

4. Upload any forms or screenshots you can share publicly below.

Agreed that they look editable right now! @Matt_Berg and others have also highlighted this issue and we'll remove the node markers in the next release.

That's not currently supported. We could add further support for geojson simple style. We haven't yet because it's more complexity and because it doesn't feel quite right. Often, form designers would rather set coloring rules based on other properties rather than having to explicitly configure each specific feature. In your case, can styling be directly determined from other properties?

I've moved your post to the Features category so we can learn more about the need.

Great to hear that removing the node markers is already planned.
Regarding assigning the color to Geoshape, I was thinking if same logic as assigning color to point can be used. At least for the polygons which are loaded via csv file.

hello all,

I have a native android developer in my team who does minor modifications in ODK collect APP.
Any possibility that someone guide us on the part that requires coding. Task is to change the color of the polygon based on the input value set to each polygon in CSV in ODK collect codebase?

Actually same developer wrote code to load polygon data from csv and set colors based on the value set. This was some time before the release of the map based Select_one option enabled for polygon.
Limitation in or current feature is information on polygon click is not there and in ODK collect on playstore no color setting option.

Thanks in advance

I am in the development phase for a new form and I can foresee a problem that might need a similar solution. So in the process of looking for the answer I found this idea overlaps with my 'requirement'.

I am working with footpaths, and we divide each path into a number of sections. Usually (but not always) the end point of one section coincides with the start point of the next... Can you see where I'm going?

So, using entities, or external file, and wanting to be able to select the path SECTION to record its current condition (for example) leads me to using a map and wanting to select_one from a series of geotraces. But, the lines appear to be one continuous and there is no way to tell whether I'm at the right location for the start / end of a section so I need to tap on a red line and hope that it being highlighted gives me a clue (the metadata of course tells me something about the item selected, but no visual clue as to where it starts or ends)

Can you tell that the central red line is split into a number of sections? Or where each one starts?

For a user, this is a poor experience, especially if they are visiting the site for the first time and don't know where the end-points are for each section. Or someone reluctantly engaging with Collect. You never want to ask an enumerator to just keep tapping on lines until they find the right one! A recipe for errors... And even cross referencing the GPS location, there is no way to tell that the position coincides with the required point. I am toying with the idea of a file that has geopoints and geotraces if they can be rendered on the same map, but that might backfire and would dramatically increase the file size if I have to load everything twice.

What I would like is to be able to set a colour value for each section (I may end up using a random colour ramp where I've got hundreds, rather than individually assign). I think this would be more useful to other situations than another option, which would be to mark the end points of each line. So for (a poorly executed) example:

I know there are going to be difficulties with visibility / backdrop mapping etc, so maybe the flexibility (complexity?) of the geojson simple style could help. If it MIGHT work, could a column in a CSV (or field in the Entity) be used to represent style such as

"stroke":"#12345", "stroke-width": 2

and Collect inserts that into the relevant part of the string when loading the map. He says, as if he knows what he's talking about!

Well, I'm just trying to contribute to the idea and how it might look to a form designer, rather than make a request and walk away :slight_smile:

I remember from the ODK Summit how introducing one extra parameter causes many more headaches, so I'm trying not to be unreasonable :slight_smile:

I'm in danger of retreating to my default position of using mbtiles raster backdrop with the lines overlain on a mapping layer, and then using geopoints to represent start-points... And all the problems that brings with it (see other forum posts!)

Thanks

I see that geoshape/geotrace styling is 'next' on the roadmap - is there an approximate date for this or any mockups of how it could look?

I have a lot of overlapping geoshapes, so currently I sort my reference list of them by area to try to surface the small ones to the top in draw order (so they're selectable and not blocked) and also add an extra filter to prune down the number shown at one time. Some colouring to differentiate by desired categories will be a huge UX improvement.

1 Like

For now we are planning on adding line and shape support for geojson simple style's stroke and stroke-width. That would enable things like @seewhy's random color assignment described above.

This is now available starting in Collect v2024.2.0.

6 Likes

I apologize for asking a question that could be resolved with testing, but my default collect is forked from an earlier version than 2024.2.0 so geojson polygons look like


and not like

using

          "marker-size": "small",
          "marker-color": "#5fff00",
          "stroke": "#5fff00",
          "fill": "#5fff00",

Electrifying, no?

I can experiment easily enough, but if there's a quick lookup for supported object names, I'd very much appreciate a link.

Also, for mapping, mujltipolygon support would be a nice add if it hasn't already been. I kinda mangled bermuda after right-hand-ruling it.

2024.2.1 view looks like this, definitely an improvement but does not support the fill object name value.

Is there a way to set polygon fill colors?

The fill special property is intended to be supported as documented. Could you please share a test form and geojson file that shows this issue?

1 Like

well.... it seems to work fine now. There was a glitch, but here's a test file, screen shot and the data collected demonstrating it works just as documented.

Collected ID

image

And sample files. Not sure why results weren't as expected last time but I re-implemented in SVG anyway.

geojson.xlsx (10.6 KB)
monogoncountries.geo.json (20.1 KB)

1 Like