UserAndre Castro/maps01/features change
Revision as of 19:02, 27 November 2011 by Andrecastro (talk | contribs) (Created page with "<source lang="python"> #! /usr/bin/python # this python script parses the osm-map-features-z17.xml and removes tag # it saves into file osm-map-features_a.xml import lxml.etre...")
#! /usr/bin/python
# this python script parses the osm-map-features-z17.xml and removes tag
# it saves into file osm-map-features_a.xml
import lxml.etree, urllib2, codecs
f = ("/home/andre/osmarender/osm-map-features-z17.xml")
doc = lxml.etree.parse(f)
# elements to delete ("//area|//circle|//symbol||//caption|//line|//wayMarker")
for i in doc.xpath( '//area|//circle|//symbol|//caption|//line|//wayMarker' ) :
i.getparent().remove(i)
text = lxml.etree.tostring(doc, encoding="utf-8", xml_declaration=True)
g = open("/home/andre/osmarender/osm-map-features_chg1.xml", "w")
g.write(text)