We propose a lightweight localisation approach for supporting distance and range queries in ad hoc wireless sensor networks. In contrast to most previous localisation approaches we use a distance graph as spatial representation where edges between nodes are labelled with distance constraints. This approach has been carefully designed to satisfy the requirements of a concrete application scenario with respect to the spatial queries that need to be supported, the required accuracy of location information, and the capabilities of the target hardware. We show that this approach satisfies the accuracy requirements of the example application using simulations. We describe the implementation of the algorithms on wireless sensor nodes.