# Creating local accurate projection for proj4?

We recently discovered that the UTM projection we have been using is not accurate enough for our application when doing calculations that require distances.

Instead of rewriting our code base to use great circle calculation I would like to understand how proj4 projections work but havent been able to google what i needed. Possible because I dont yet know exactly what to google for.

I have a lat,lng of a point that I want to place my local projection around and the area it should cover is a radius of 25km. How would I create a proj4 string for this local projection with units of meters.

great circles in QGIS and export in 3857 webmap discribes how to set up an Azimuthal Equidistant Projection projection to create great circles. The projection is however based on a sphere, not an ellipsoid.

Using customized Coordinate System in ArcGIS Desktop? shows you how to set up a local transverse mercator or oblique mercator projection.

For the accuracy, see

http://geotiff.maptools.org/proj_list/azimuthal_equidistant.html

http://geotiff.maptools.org/proj_list/random_issues.html

Manipulating Azimuthal Equidistant Projections in QGIS

https://trac.osgeo.org/proj/ticket/246

Just for reference, here is the solution I ended up creating for ol3.

createLocalProjection.ts creates a local projection with center in a given point and extend calculated using a buffer in meters. this provides a accurate local coordinate system around that point.

``````import ol = require("openLayers");
import proj4 = require("proj4");

ol.proj.setProj4(proj4);

export function createLocalProjection(projkey: string, center_wgs84: number[], buffer_meter: number) {
proj4.defs(projkey, `+proj=tmerc +lat_0=\${center_wgs84} +lon_0=\${center_wgs84} +x_0=0 +y_0=0 +towgs84=0,0,0,0,0,0,0 +units=m +vunits=m +no_defs`);

var newProj = ol.proj.get(projkey);
var fromLonLat = ol.proj.getTransform('EPSG:4326', newProj);
let center = fromLonLat(center_wgs84);
let extent = [center - buffer_meter, center - buffer_meter, center + buffer_meter, center + buffer_meter];
newProj.setExtent(extent);

return newProj;
}
``````