An arrangement for controlling the unloading of a forestry machine, in which the forestry machine comprises a load space for timber load, a boom structure and a wood-handling tool attached to said boom structure, which arrangement further comprises a control system and a measuring apparatus of the forestry machine, wherein - said measuring apparatus is arranged to measure the location of the forestry machine and the rotation angle of the boom structure and the position of the single boom parts of the boom structure and the position of the wood-handling tool, wherein - said control system is arranged: - to define and note down the location of a timber pile characterised in that the control system is further arranged: - to calculate and note down the position of an edge of the timber pile, - to control the wood-handling tool to pick a timber bundle from the timber load, - to calculate the distance of an end justified to a load screen of said timber bundle from the wood-handling tool, - to calculate an unloading location for said timber bundle into a timber pile even and straight of its one edge in the defined timber pile location, and - to control and unload said timber bundle in said calculated unloading location in the timber pile. - said measuring apparatus is arranged to measure the location of the forestry machine and the rotation angle of the boom structure and the position of the single boom parts of the boom structure and the position of the wood-handling tool, wherein - said control system is arranged: - to define and note down the location of a timber pile characterised in that the control system is further arranged: - to calculate and note down the position of an edge of the timber pile, - to control the wood-handling tool to pick a timber bundle from the timber load, - to calculate the distance of an end justified to a load screen of said timber bundle from the wood-handling tool, - to calculate an unloading location for said timber bundle into a timber pile even and straight of its one edge in the defined timber pile location, and - to control and unload said timber bundle in said calculated unloading location in the timber pile. - to define and note down the location of a timber pile characterised in that the control system is further arranged: - to calculate and note down the position of an edge of the timber pile, - to control the wood-handling tool to pick a timber bundle from the timber load, - to calculate the distance of an end justified to a load screen of said timber bundle from the wood-handling tool, - to calculate an unloading location for said timber bundle into a timber pile even and straight of its one edge in the defined timber pile location, and - to control and unload said timber bundle in said calculated unloading location in the timber pile. - to calculate and note down the position of an edge of the timber pile, - to control the wood-handling tool to pick a timber bundle from the timber load, - to calculate the distance of an end justified to a load screen of said timber bundle from the wood-handling tool, - to calculate an unloading location for said timber bundle into a timber pile even and straight of its one edge in the defined timber pile location, and - to control and unload said timber bundle in said calculated unloading location in the timber pile.