Mechanisms responsible for the local geometry around Jahn-Teller impurities in K2NiF4 type lattices are shown to be different from those generating the warping in cubic crystals. The present density functional theory calculations reveal that the elastic anisotropy of the host lattice (visible for closed shell impurities) and the electric field created by the rest of lattice ions upon active electrons make it possible to have d(9) ions in an elongated geometry but with a A(1g) ground state. The puzzling difference between equilibrium geometries for Cu2+ and Ni+ in layered perovskites can reasonably be understood.