Using geographic routing, like GPSR, is efficient for ad hoc and wireless sensor networks, but it requires that nodes be aware of their physical positions. However, if there are holes in the network, routing across them using GPSR will lead to a lot of overloaded nodes on their boundaries. In this paper, we propose a distributed protocol, named hexagonal virtual coordinate (HVC), for constructing a virtual coordinate system. After the HVC is constructed, the nodes in the network will be aware of the relative coordinates among the landmarks through the HVC chart. Based on the HVC chart, a source node can find an auxiliary routing path (ARP) to indicate the direction of the journey from the source to the destination. Simulation results show that our protocol can support geographic routing efficiently, and the landmarks found by our protocol are uniformly located in the network even if some holes exist within it. In addition, our protocol is resilient to various network shapes and can find a load balancing routing path to the destination even if this path comes across holes in the network. Copyright (C) 2008 John Wiley & Sons, Ltd.