Re: [OSM-dev] Adding support for relations to change_tags.py and other stuff
Christopher Schmidt <crschmidt <at> metacarta.com>
2009-04-01 11:36:11 GMT
On Wed, Apr 01, 2009 at 09:32:01AM +0000, Ævar Arnfjörð Bjarmason wrote:
> (CC-ing to OSM-dev in case anyone else finds this interesting)
> Background: I've been looking for some sort of XML-SAX-like engine to
> do massive changes to OSM data so that I can do mass-edits without
> writing all the tedious parsing/upload/diff logic myself.
> change_tags.py looks perfect for this with a few caveats, some of
> which have patches & suggestions for:
> Firstly it doesn't handle relations, in the attached patch I've
> implemented support for this which seems to work, except:
> * The Nodes/Ways/Relations count doesn't seem to work.
> This appears to be due to some race condition in the XML parser I
> can't find, if I change the counting code around line 300 to this:
> if name in ['node', 'way', 'relation', 'tag']:
> if name == 'relation':
> print "Read relation"
> self.read[name] += 1
> And run this command:
> PYTHONPATH=. python
> ~/src/osm/applications/utils/change_tags/change_tags.py --dry-run
> --verbose --check-api --file Iceland.osm --module iceland --function
> Nodes: 259621/0, Ways: 5288/0, Relations: 0/0, 0 complete