In this letter, the localization of terrestrial nodes when unmanned aerial vehicles (UAVs) are used as base stations is investigated. Particularly, a novel localization scenario based on received signal strength (RSS) from terrestrial nodes is introduced. In contrast to the existing literature, our analysis includes height-dependent path loss exponent and shadowing which results in an optimum UAV altitude for minimum localization error. Furthermore, the Cramer-Rao lower bound is derived for the estimated distance which emphasizes, analytically, the existence of an optimal UAV altitude. Our simulation results show that the localization error is decreased from over 300m when using ground-based anchors to 80m when using UAVs flying at the optimal altitude in an urban scenario.