What you are looking for is a cartographic projection, the choice of which is a study area on its own; the accuracy of the projection depends on the area you are mapping and the type of distortion you are willing to afford (distance distortion in a particular distortion, area distortion, shape distortion).
There are about two hundred different projections, most of which have a lot of local variants. Try googling first. If you want better advice, you will have to provide us with more information about your data.
What you are using in the example is the Equirectangular projection, which is simple but only finds use in global thematic maps that do not require particular accuracy such as thematic maps.