Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling non-string tags #49

Open
gmaclennan opened this issue Apr 9, 2020 · 0 comments
Open

Handling non-string tags #49

gmaclennan opened this issue Apr 9, 2020 · 0 comments

Comments

@gmaclennan
Copy link
Member

Mapeo Mobile and Desktop (Observation View) support tag values to be non-strings, e.g. they could be a number, boolean or array (for select multiple fields). iD Editor (and I think the OSM API) only recognizes string values. This could cause errors or bugs when editing observations in the territory view. It could either cause iD to crash, or result in a value being converted to a string.

We haven't actually implemented number or boolean fields in Mapeo Mobile yet, but we have added support for multi-select fields, which store the value as an Array. This is the only place currently where we would encounter non-string tags "in the wild".

One (hacky) approach would be to strip non-string tags from the observation when we convert it, and add them back when it is edited. This might cause some user confusion because some fields would appear empty (when they actually have non-string data) and if they edited those empty fields then the edits would be overwritten (with the non-string values from the server). However, we could also modify the presets that are passed to iD Editor to remove any fields which are non-string, which would hide the fields completely from the Territory view.

The other option would be to add support for different types in the iD code, but this would be a fair amount of work.

TL;DR in obj2osm remove tag properties whose typeof tag[key] !== string and put them back in osm2obj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant