In contrast to traditional wireless sensor network (WSN) applications that perform only data collection and aggregation, the new generation of information processing applications such as pursuit-evasion games, tracking, evacuation, and disaster relief applications require in-network information storage and querying. Due to the resource limitations of WSNs, it is challenging to implement in-network querying in a distributed, lightweight, resilient, and energy-efficient manner. We address these challenges by exploiting location information and the geometry of the network and propose an in-network querying framework, namely, the Distributed Quad-Tree (DQT). DQT is distance sensitive for querying of an event: the cost of answering a query for an event is at most a constant factor (2radic(2) in our case) of the distance *d* to the event. DQT construction is local and does not require any communication. Moreover, due to its minimalist infrastructure and stateless nature, DQT shows graceful resilience to node failures and topology changes. Since event-based querying is inherently limited to the anticipated types of inquiries, we further extend our framework to achieve complex range-based querying. To this end, we use a multiresolution algorithm, which is optimal with respect to least square errors that models the data in a decentralized way. Our model-based scheme answers queries with approximate values accompanied by certainty levels with increased resolution at lower layers of the DQT hierarchy. Our analysis and experiments show that our framework achieves distance sensitivity and resiliency for event-based querying, as well as greatly reduces the cost of complex range querying.