Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use XML::Twig;
- use warnings;
- use strict;
- use utf8;
- binmode(STDOUT, ":utf8");
- die "Usage: $0 <file.osm>" unless defined $ARGV[0];
- my $twig = XML::Twig->new(
- twig_handlers => {
- 'node' => \&rotate,
- },
- pretty_print => 'indented',
- );
- $twig->parsefile($ARGV[0]);
- $twig->flush;
- sub rotate {
- my ($twig, $elt) = @_;
- my $lon = $elt->att('lon');
- my $lat = $elt->att('lat');
- # do processing
- $lon += 1;
- $lat += 1;
- $elt->set_att('lon', $lon);
- $elt->set_att('lat', $lat);
- $elt->set_att('action', 'modify');
- $elt->flush;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement