Spatial knowledge is a fundamental building block for the development of advanced perceptive and cognitive abilities. Traditionally, in robotics, the Euclidean (x,y,z) coordinate system and the agent's forward model are defined a priori. We show that a naive agent can autonomously build an internal coordinate system, with the same dimension and metric regularity as the external space, simply by learning to predict the outcome of sensorimotor transitions in a self-supervised way.