We study the following problem. Given a weighted planar graph G, assign labels L(v) to vertices so that given L(u), L(v) and L(x) for x ∈ X for any X ⊂ V (G), compute the distance dG\X(u, v). We show how to construct in polynomial time such a labeling with labels of O(k) bits1 for every n-vertex planar graph of treewidth k, which is O(n1/2 ) for general planar graphs. Our scheme also gives a compact routing scheme using labels of the same size. This improves the previous O(k2 ) bound for treewidth-k graphs [7]. Surprisingly, this matches the best-known bound for static (X = ∅) distance labeling in planar graphs, and is optimal to within polylogarithmic factors.