So what's wrong with the code? It's what the dude did in the video. Just not working.
# This code is called when instances of this SOP cook.
node = hou.pwd()
geo = node.geometry()
# Add code to modify the contents of geo.
def createCity():
import xml.dom.minidom
document=“”“
<osm version=”0.6“ generator=”Overpass API“>
<bounds minlat=”48.8423“ minlon=”2.3157“ maxlat=”48.8665“ maxlon=”2.3831“/> <node id=”361029“ lat=”48.8457739“ lon=”2.3675260“ version=”8“ timestamp=”2016-02-27T23:10:15Z“ changeset=”37491193“ uid=”522742“ user=”josmougn“/>
<node id=”361031“ lat=”48.8474791“ lon=”2.3655560“ version=”10“ timestamp=”2010-04-24T20:33:32Z“ changeset=”4515716“ uid=”17286“ user=”Pieren“>
<node id=”361032“ lat=”48.8508895“ lon=”2.3672954“ version=”5“ timestamp=”2010-04-24T19:09:56Z“ changeset=”4514867“ uid=”17286“ user=”Pieren“>
<node id=”361035“ lat=”48.8521381“ lon=”2.3695760“ version=”6“ timestamp=”2012-09-17T10:15:20Z“ changeset=”13141345“ uid=”456113“ user=”eric_G“/>
<node id=”361036“ lat=”48.8487850“ lon=”2.3679961“ version=”10“ timestamp=”2010-01-19T22:34:18Z“ changeset=”3662928“ uid=”33634“ user=”lapinos03“/>
<node id=”361038“ lat=”48.8428684“ lon=”2.3639709“ version=”9“ timestamp=”2012-10-07T15:43:26Z“ changeset=”13399945“ uid=”456113“ user=”eric_G“/>
<node id=”361046“ lat=”48.8399618“ lon=”2.3618169“ version=”14“ timestamp=”2011-02-08T22:27:26Z“ changeset=”7231649“ uid=”17286“ user=”Pieren“/>
<node id=”361047“ lat=”48.8416665“ lon=”2.3519925“ version=”5“ timestamp=”2012-11-08T17:39:03Z“ changeset=”13799861“ uid=”456113“ user=”eric_G“>
<osm/>
”“”
map = xml.dom.minidom.parseString(document)
if(map.documentElement.tagName != “osm”):
print ('Bad File Type')
return
def handleNodes(xmlData):
bounds = xmlData.getElementsByTagName(“bounds”)
minlat = float(bounds.getAttribute('minlat'))
maxlat = float(bounds.getAttribute('maxlat'))
minlon = float(bounds.getAttribute('minlon'))
maxlon = float(bounds.getAttribute('maxlon'))
normalizingFactor = sizeMultiplier / max((maxlon-minlon),(maxlat-minlat))
nodes = xmlData.getElementsByTagName('node')
for node in nodes:
lat = float(node.getAttribute('lat'))
lon = float(node.getAttribute('lon'))
normalizedLat = (lat-minlat) * normalizingFactor
normalizedLon = (lon-minlon) * normalizingFactor
point = geo.createPoint()
handleNodes(map)
map.unlink()
createCity()