This paper provides a spatial general equilibrium model to quantify the impact of climate change on the economy and migration. The model can capture the role of the transportation network and agricultural suitability on the distribution of population and GDP accounting for endogenous adjustments of crop choice and trade. I use detailed geospatial data from 42 countries in sub-Saharan Africa (SSA) to simulate the impact of climate using forecasts of agricultural productivity in 2080. Climate change is estimated to displace 12 percent of the SSA population and reduce real GDP by 4 percent. The capacity of switching crops, urbanizing, or trading goods is found to reduce the impact of climate change in terms of population outflows. Finally, I find that the adoption of modern inputs in agriculture can reverse considerably the negative impacts of climate change.