Controlling for spatial heterogeneity and spatial dependence in farmland valuation models has gained substantial attention in recent literature. This paper proposes to derive the spatial structure of farmland values endogenously and semiparametrically based on the spatial competition theory. The paper assembles panel data of Pennsylvania county level farmland values between 1982 and 2012. A spatial autoregressive panel data model with spatial weights matrix endogenously incorporated is estimated. Out of sample predictions and non-nested statistical tests for model selection suggest that the fit and the predictability of hedonic farmland valuation models can be greatly improved.