Much of the literature on the endogenous generation of a city employs increasing returns to scale in order to obtain agglomeration. In contrast, the model considered here focuses on the role of marketplaces or trading centers in the agglomeration of population as cities. Gains to trade in combination with transportation and marketplace setup costs suffice to endogenously generate a city or cities with one or multiple marketplaces. It is assumed that consumers are fully mobile while production functions are location-specific. The exchange of commodities takes place in competitive markets at the marketplaces, while the number and locations of the marketplaces are determined endogenously using a core concept. Unlike the standard literature of urban economics, our model can deal with differences in geography by letting the setup costs of marketplaces and the transportation system depend on location. After showing that an equilibrium exists and that equilibrium allocations are the same as core allocations, we investigate the equilibrium number and locations of marketplaces, the population distribution, and land prices. In contrast with earlier literature, the results are general in the sense that specific functional forms are not needed to obtain existence of equilibrium, equilibria are first best, and equilibria are locally unique (in our examples).