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

Providing space in conditional restriction not considered as a modification in iD #4925

Closed
krishnanammala opened this issue Mar 22, 2018 · 2 comments
Labels
bug A bug - let's fix this!

Comments

@krishnanammala
Copy link

While trying to modify the conditional restriction for School days of adding space for SH off after ; syntax restriction:conditional=no_u_turn @ (Mo-Fr 09:00-10:00,15:00-16:00; SH off) as per wiki the iD editor is not considering it as a modification and not allowing to upload the data to OpenStreetMap.

id

iD link, mapillary link

cc @bhousel

@bhousel
Copy link
Member

bhousel commented Mar 22, 2018

Thanks for reporting @krishnanammala ...

This is one of those weird OSM edge cases. Most of the time OSM expects spaces around ';' removed, but inside of an opening hours string, they want the spaces kept.

We have special code in here to handle the situation:

function keepSpaces(k) {
return k.match(/_hours|_times/) !== null;
}
var blacklist = ['description', 'note', 'fixme'];
if (_some(blacklist, function(s) { return k.indexOf(s) !== -1; })) return v;
var cleaned = v.split(';')
.map(function(s) { return s.trim(); })
.join(keepSpaces(k) ? '; ' : ';');

I'll have to change this code to apply the space keeping rule whenever a conditional clause is detected.

(using this page for reference with some complex examples:
https://wiki.openstreetmap.org/wiki/Conditional_restrictions )

@bhousel
Copy link
Member

bhousel commented Mar 22, 2018

Also, it seems like a value can have multiple conditionals, and in this situation they are also semicolon-space delimited:

maxspeed:conditional=120 @ (06:00-20:00); 80 @ wet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug - let's fix this!
Projects
None yet
Development

No branches or pull requests

2 participants