   obj = {}
   routeIds = d3.set()
   segmentIds = d3.set()
+  naturalIds = d3.set()
+
   for o in osm.elements
     obj[o.id] = o
 


  layers = {
    segments: layer(segment(id) for id in segmentIds.values())
  }

  return {
    topo: topojson.topology(layers, quantization: 1000000)
    bbox: bbox
    routes: route(obj[id]) for id in routeIds.values()
  }

      for m in o.members
        if m.type == 'way'
          segmentIds.add(m.ref)

    if o.type == 'node' and o.tags? and o.tags.natural?
      naturalIds.add(o.id)


  pos = (id) -> node = obj[id]; return [node.lon, node.lat]
