NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

1
1

I screwed up. I did a lot of work editing Tiger data in my hometown of Homer, Alaska. Afterward I read about updating the Tiger-reviewed tag on all those ways so that subsequent Tiger imports wouldn't overwrite my changes. Not wanting to edit each way individually I merely selected multiple ways in JOSM and changed the Tiger tags to Tiger-reviewed=yes. A dozen or so big selections later I was done.

Earlier this week I discovered to my surprise and chagrin that every single NODE included in my selections now carries the Tiger_reviewed=yes tag. That was certainly not expected and I would lke a way to undo those changes. A roll-back is not desirable because a ton of other useful edits would get tossed with the Tiger tags.

I could do what I need to do in a desktop database like Access with a fairly simple SQL statement but the OSM database is a different beast altogether.

My question: Is there any way to select just those nodes that have the Tiger_reviewed=yes tagging in my neighborhood and delete that tag? The ways are fine with that tagging of course. It's just the nodes I want to strip of Tiger tags.

asked 14 Apr '13, 15:25

AlaskaDave's gravatar image

AlaskaDave
5.4k76107164
accept rate: 16%

edited 14 Apr '13, 19:27

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554


Here's an example of doing a mass change. Let's say you forgot to add "http://" in front of every 'website' url tag you added and now want to correct this.

In Overpass turbo, you can select your area/edits by modifying the following query:

[out:xml][timeout:25];
// gather results
(
  node["website"~"^[^h][^t][^t][^p].*"]({{bbox}});
  way["website"~"^[^h][^t][^t][^p].*"]({{bbox}});
  relation["website"~"^[^h][^t][^t][^p].*"]({{bbox}});
);
// print results
out meta;
>;
out meta qt;

You can then open the results of this query in JOSM, and save it to a .osm file. After it's saved, you can use xmlstarlet to modify the tag. You also need to add 'action=modify' to the nodes you changed. Finally, compare the original and your edited file.

xmlstarlet ed -P -u "//tag[@k='website']/@v"  -x 'concat("http://", .)'  ~/Desktop/websites.osm > ~/Desktop/websites-edit.osm
xmlstarlet ed -L -i "//tag[@k='website']/.."  -t 'attr' -n 'action' -v 'modify' ~/Desktop/websites-edit.osm 
diff -y -W421 ~/Desktop/websites.osm ~/Desktop/websites-edit.osm | less

Load the edited file into JOSM, validate it, and upload.

Of course the usual caveats regarding mass edits apply, so make sure you are only fixing your own mistakes or have circulated you change with correct mailing list.

permanent link

answered 26 Nov '14, 13:56

brianegge's gravatar image

brianegge
1264511
accept rate: 0%

Thanks Brian,

I did those edits long ago in JOSM but your answer intrigues me nonetheless. Lets say I want to substitute one sub-string for different one? These are all my own additions I'm wanting to edit. It's a special case where I used a description:en tag set to Mile Zero Milestone and want to change that to read Kilometer Zero Milestone. There is other information in the description:en that I want to keep which is why I want only to replace the word "Mile" with the word "Kilometer".

(27 Nov '14, 07:40) AlaskaDave

A quick look at xmlstarlet convinced me that I don't want to learn its intricacies at the moment. So perhaps you'd be willing to provide the command line? By the way, I'm running Windows, not Unix, and there are approximately 40 nodes (no ways or relations) that need editing.

Thanks again Dave

(27 Nov '14, 07:40) AlaskaDave

xmlstarlet is tricky - but powerful. The two commands I wrote should have been able to have been written as one, but I couldn't figure it out. You can use a text editor to do search/replace. For 40 nodes, it might be easiest to edit them manually in JSOM. You can do 'Search Next', and then edit your tag.

(27 Nov '14, 12:01) brianegge
1

For JOSM the todo list plugin can also become helpful for such tasks.

(27 Nov '14, 13:41) scai ♦

Thank you both for responding. I can do this edit in JOSM, and yes, the ToDo list plugin is helpful. I've used it before in similar situations. I want to eventually learn how to download OSM data into a local postgreSQL database and manipulate it with SQL commands, with which I am already familiar. The mention of xmlstarlet got me thinking along those lines.

Cheers

(28 Nov '14, 00:29) AlaskaDave

Type the following in the search box in JOSM

Tiger_reviewed:yes type:node

More examples of search queries: http://wiki.openstreetmap.org/wiki/JOSM search function

permanent link

answered 14 Apr '13, 18:05

cartinus's gravatar image

cartinus
7.0k1066105
accept rate: 27%

I tried every combination of your suggested query that I could come up with.

Tiger_reviewed:yes type:node

type:node key:"tiger:reviewed=yes"

type:node tiger:reviewed

type:node key:tiger:reviewed

and even

type:node key:tiger yes

None of these produced results. I tried them both with and without an active selection. WTF?

Finally I hit on simply selecting ALL nodes, i.e., only the words type:node in the search box. I discovered that the nodes making up the ways I tagged do not inherit tags from their "parents" so when the results appeared I merely deleted the tiger:reviewed tag. It affected nodes only, which is just what I wanted.

Thanks for your help...

(14 Apr '13, 19:24) AlaskaDave

Try ("tiger:reviewed"=yes) (type:node)

By the way, am I doing it wrong? Instead of changing tiger:reviewed=no to yes I delete the tag.

(27 Nov '14, 03:09) n76

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×622
×14
×12

question asked: 14 Apr '13, 15:25

question was seen: 7,385 times

last updated: 28 Nov '14, 00:29

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum