A new method of identifying the plasma boundary and X-points in elongated tokamaks is presented. The method uses a finite element representation of the plasma current. It is applied to a number of computed equilibria with various shapes and elongations up to b/a = 3. Errors in the flux, magnetic field and coil current measurements are simulated by adding random perturbations to the values obtained from the equilibrium code. The method appears to be sufficiently accurate and fast for real-time shape control.