Skip to content

Instantly share code, notes, and snippets.

@bhousel
Last active August 29, 2015 14:21
Show Gist options
  • Save bhousel/0af881a621a2efb83719 to your computer and use it in GitHub Desktop.
Save bhousel/0af881a621a2efb83719 to your computer and use it in GitHub Desktop.
Hotkey to change some tags on all selected entities in #iD
context = id;
addTags = { building: 'yes' };
removeTags = ['area','natural','landuse'];
function changeTags() {
var actions = [],
entities = _.filter(_.map(context.selectedIDs(), context.entity),
function(entity) { return entity.geometry(context.graph()) === 'area'; });
_.each(entities, function(entity) {
var newTags = _.omit(_.merge(_.clone(entity.tags), addTags), removeTags);
actions.push(iD.actions.ChangeTags(entity.id, newTags));
});
if (actions.length) {
actions.push(t('operations.change_tags.annotation'));
context.perform.apply(context, actions);
}
}
myKeybinding = d3.keybinding('changeTags')
.on(iD.ui.cmd('⌘B'), changeTags);
d3.select(document).call(myKeybinding);
@davidshumway
Copy link

Progress at https://github.com/their/OSM-iD-Browser-Tools. After autofocus it is pretty much down to features "add new area" and "orthogonalize".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment