 fs = require('fs')
 request = require('request')
 topojson = require('topojson')
+turf = require('turf')
 Q = require('q')
 
 


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

  segment = (id) -> way = obj[id]; return {
    type: 'Feature'
    id: id
    geometry:
      type: 'LineString'
      coordinates: pos(n) for n in way.nodes
  }

  natural = (id) -> node = obj[id]; return {
    type: 'Feature'
    id: id
    properties:
      name: node.tags.name
      type: node.tags.natural
    geometry:
      type: 'Point'
      coordinates: [node.lon, node.lat]
  }

  layer = (features) -> {type: 'FeatureCollection', features: features}

  route = (relation) ->
    segments = []

    }

  layers = {
    segments: turf.featurecollection(segment(id) for id in segmentIds.values())
    poi: turf.featurecollection(natural(id) for id in naturalIds.values())
  }

  return {
