On Sat, Sep 12, 2009 at 6:28 PM, Peppo Herney <peppo.her...@gmx.de> wrote:
> thanks for the offer:
>> Can you attach the file in a message to this list? Perhaps I (or
>> someone else) can convert it for you.
>
> I also wouldn'd mind to learn how to convert this conveniently.
> Please tell, how you converted afterwards.

Here's the converted file (too big for the 40 KB mailing list limit):
http://u.nix.is/~avar/hutten.osm

To accomplish really simple tasks like these I usually use GNU Emacs
keyboard macros[1], instead of say writing a short Perl script. The
process is basically that I look at the first line and convert it
manually, e.g. by changing:

   Aarbiwak SAC

to

  <tag k="name" v="Aarbiwak SAC"/>

Then I go to the next ";" to find the next thing, and convert that too, etc.

When I get to "8,152199642;46,55547325" I cut that out my seeking
across ";" twice. Then I seek back and add that to the <node> part I
added at the beginning, using query-replace to convert "," to ".".
Finally I update the id="" with a numeric register[2].

Then I move my cursor to the next line and tell Emacs "hey, remember
all that manual labour I did, please repeat that for the rest of the
file". At which point it automatically converts the entire thing to
what I've just attached (I only needed to add opening & closing <osm>
tags at the beginning/end afterwards).

Here's the ad-hoc Emacs keyboard macro I used. It's basically a raw
log of every keystroke I pressed and commands I issued during the
above, so not very readable: http://paste.lisp.org/display/86987

All-in-all the whole process took around 3-4 minutes. Writing this
E-Mail took much longer. I'd really recommend learning Emacs or a
similarly powerful editor (I'm not aware of any) if you happen to do a
lot of text editing that could be helped if it were
automated/programmable.

1. http://www.gnu.org/software/emacs/manual/html_node/emacs/Keyboard-Macros.html
2. 
http://www.sunsite.ualberta.ca/Documentation/Gnu/emacs-20.7/html_chapter/emacs_11.html#SEC71

_______________________________________________
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk

Reply via email to