Transforming point from EPSG:3844 to EPSG:3857

204 Views Asked by At

I'm having an issue transforming a point from EPSG:3844 to EPSG:3857 using Proj4JS. The transformation it performs seems off compared to the result given by PostGIS, pyproj, rgeo-proj4 or even epsg.io.

PostGIS sample:

select st_astext(st_transform(st_geomfromtext('point(432142.945 474552.670)', 3844), 3857));

This is the code in question:

proj4.defs([
  [
    'EPSG:3844',
    '+proj=sterea +lat_0=46 +lon_0=25 +k=0.99975 +x_0=500000 +y_0=500000 +ellps=krass +towgs84=2.329,-147.042,-92.08,0.309,-0.325,-0.497,5.69 +units=m +no_defs +type=crs',
  ],
  [
    'EPSG:3857',
    '+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs',
  ],
]);
const actual = proj4('EPSG:3844', 'EPSG:3857', [432142.945, 474552.67]);
const expected = [2685681.568887065, 5743146.959786006];
console.log('Actual:', actual);
console.log('Expected:', expected);
<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.8.0/proj4.js"></script>

1

There are 1 best solutions below

2
On

Change EPSG:3844 parameters from this:

"EPSG:3844","+proj=sterea +lat_0=46 +lon_0=25 +k=0.99975 +x_0=500000 +y_0=500000 +ellps=krass +towgs84=2.329,-147.042,-92.08,0.309,-0.325,-0.497,5.69 +units=m +no_defs +type=crs",

into:

"EPSG:3844","+proj=sterea +lat_0=46 +lon_0=25 +k=0.99975 +x_0=500000 +y_0=500000 +ellps=krass +towgs84=2.3287,-147.0425,-92.0802,-0.3092483,0.32482185,0.49729934,5.68906266 +units=m +no_defs +type=crs"