 
     render: ->
       @map = new google.maps.Map(@el,
-        center: @currentPosition or new google.maps.LatLng(60.171, 24.941) # Rautatieasema
         zoom: 16
         mapTypeId: google.maps.MapTypeId.ROADMAP
         mapTypeControlOptions:
           position: google.maps.ControlPosition.TOP_CENTER
         minZoom: 10,
-        maxZoom: 18
+        maxZoom: 18,
+        scaleControl: true
       )
+
+      # If we already have the user's current position, use it. If not, center
+      # the map to it as soon as everything is initialized and we have the
+      # location.
+      if initPos = window.initialPosition
+        @centerMap(initPos.coords.latitude, initPos.coords.longitude)
+      else
+        @centerMap(60.171, 24.941) # Rautatieasema
+        Reitti.Event.on 'position:change', (position) =>
+          _.once @centerMap(position.coords.latitude, position.coords.longitude)
+
       @
 
     drawRoute: (route) =>

    panToLegBounds: (leg) =>
      @map.fitBounds @routeView.getBoundsForLeg(leg)
      
    centerMap: (position) ->
      latLng = new google.maps.LatLng position.coords.latitude, position.coords.longitude
      @map.setCenter latLng

    displayCurrentPosition: (position) ->
      latLng   = new google.maps.LatLng position.coords.latitude, position.coords.longitude

  'async!http://maps.googleapis.com/maps/api/js?sensor=true' + if window.location.host is 'localhost' then '' else '&key=AIzaSyDZj9_A4WUDGph6cKf2A7VsFbDz6Pb7QBk'
], ($, _, Backbone, MapRouteView) ->
      

  # Roughly the greater Helsinki area
  maxBounds = new google.maps.LatLngBounds(
    new google.maps.LatLng 59.99907, 24.152104
    new google.maps.LatLng 60.446654, 25.535784
  )

  class MapView extends Backbone.View

    el: $('#map')

    initialize: ->
      Reitti.Event.on 'position:change', (position) =>
        @displayCurrentPosition position

