     init: () ->
 
   class location
-    constructor: (@position, @name, @icon) ->
+    constructor: (@position, @name, @data, @icon) ->
       @marker
+      @value
 
     addTo: (map) ->
       if @icon

    for item in data.result.records
      if item['dcterms:spatial']
        if item['dcterms:spatial'].split(';')[1]
          processedData.push(item['dcterms:spatial'].split(';'))
    return processedData

  generateMarkers = (set) ->
    marker = []
    i = 0
    for place in set
      lat = parseFloat(place[1].split(',')[0])
      lng = parseFloat(place[1].split(',')[1])
      marker[i] = new location {lat, lng}, place[0]
      marker[i].addTo(googleMap)
      i++
    return

  googleMap = new google.maps.Map($('#map')[0], {
    zoom: 6,
    center: {lat:-27.4698, lng: 153.0251}
  })

  mark = new player {lat: -25.363, lng: 151.044}, 'Mark', 'https://developers.google.com/maps/documentation/javascript/images/custom-marker.png'
  mark.initTo(googleMap)
  #brisbane = new location {lat:-27.4698, lng: 153.0251}, 'brisbane'
  #brisbane.addTo(@map)

  retrieveResources(100).then (res) ->
    generateMarkers(processData(res))
    return

  return
        position: @position,
        map: map,
        icon: @icon,
        title: @name,
        optimized: false,
        zIndex: 100
      })
    
    moveTo: (location) ->
      console.log("current position", this.position, "new position", location.position, "distance travelled", distanceTravelled(this.position, location.position) + 'km')
      @position = location.position
      @playerMarker.setPosition(new google.maps.LatLng(location.position.lat, location.position.lng))
      updateMarkers()

    updateStats: (stats) ->
      @stats = stats
      $('#infoOverlay #stats #workingCapital').text 'Working Capital $' + @stats.workingCapital
      $('#infoOverlay #stats #capital').text 'Capital $' + @stats.capital
      $('#infoOverlay #stats #assets').text 'Assets $' + @stats.assets
      $('#infoOverlay #stats #liabilities').text 'Liabilities $' + @stats.liabilities

  retrieveResources = (amount) ->
    reqParam = {
