UserAndre Castro/maps01/features change

From XPUB & Lens-Based wiki
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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 
#! /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)