PJ99
PJ99

Reputation: 49

proj4js vertical shift grid not functioning

I have a Next Js project using the following component

import Proj4 from 'proj4';
Proj4.defs('EPSG:27700_15', '+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +vgridshift +grids=public/grids/uk_os_OSGM15_GB.tif +no_defs');
Proj4.defs('EPSG:4326_08', '+proj=longlat +datum=WGS84 +vgridshift +grids=public/grids/us_nga_egm2008_1.tif +no_defs');

export function convertENHToLatLongElev(easting: number, northing: number, height: number): number[] {
    const osgb36 = Proj4('EPSG:27700_15', 'EPSG:4326_08');
    const convertedCoords = osgb36.forward([easting, northing, height]);
    const formattedCoords = convertedCoords.map(coord => Number(coord.toFixed(8)));
    return formattedCoords;
}

The two shift grid files are stored in the upper most project directory (my_project/public/grids)

I can't for the life of me get the output ellipsoid elevation to be different to the input ortho height. In reality it should be around 50m different in the UK.

To prove it is a vgridshift file issue. I have tried renaming each file incorrectly and I get the same result. So I presume it is a case of Proj4 not finding the files.

Upvotes: 0

Views: 35

Answers (0)

Related Questions