       lineWidth: 0
 
     sublayers.push
-      sql: "select * from #{args.table} where iso_3 = '#{tileConfig.iso3}'"
-      cartocss: @_addSelectedStyle args
+      sql: "SELECT * FROM #{args.table} WHERE iso_3 = '#{tileConfig.iso3}'"
+      cartocss: @_generateCartocss(args)
     sublayers
 
   addRegionTiles: (tileConfig, sublayers) ->
     args =
-      cartocss: ''
       table: 'continents'
       attrName: 'continent'
       attrVal: "'#{tileConfig.regionName}'"

      lineWidth: 0

    sublayers.push
      sql: "select * from #{args.table} where continent = '#{tileConfig.regionName}'"
      cartocss: @_addSelectedStyle args
    sublayers

  addCartodbTiles: (tileConfig) ->
    # Always show the wdpa layer:
    cartocss = """
      #wdpa_point, #wdpa_poly {
        line-color:#40541b;
        line-width:0.05;
        polygon-fill:#83ad35;
        polygon-opacity:0.7;}
    """

    sublayers = [
      sql: """
        SELECT the_geom FROM wdpa_point
          UNION ALL
        SELECT the_geom FROM wdpa_poly
      """
      cartocss: cartocss
    ]
    if tileConfig.wdpaId?
      sublayers = @addSelectedWdpaTiles tileConfig, sublayers, 0
    if tileConfig.iso3?
      sublayers = @addCountryTiles tileConfig, sublayers
    if tileConfig.regionName?
      sublayers = @addRegionTiles tileConfig, sublayers
    carto_tiles = new cartodb.Tiles(
      sublayers: sublayers
      user_name: "carbon-tool"
    )
    carto_tiles.getTiles( (o) =>
      L.tileLayer(o.tiles[0]).addTo @map
    )

    x1 = bounds[0][1]
    x2 = bounds[1][1]
    if x1 < 0 and x2 >= 0
      return Math.abs(x1) + Math.abs(x2)
    else
      max = Math.max(Math.abs(x1), Math.abs(x2))
      min = Math.min(Math.abs(x1), Math.abs(x2))
