node-gdal
node-gdal copied to clipboard
Difference in output between node-gdal and gdaltransform
I was reprojecting some points and noticed the output is off about 100 ft compared to gdaltransform. Tested using Node 8.11 and 10.9.
var gdal = require('gdal')
var source = new gdal.SpatialReference.fromEPSG(32028)
var dest = new gdal.SpatialReference.fromEPSG(4326)
var transform = new gdal.CoordinateTransformation(source, dest)
console.log(transform.transformPoint(2397350, 386280))
// console output { x: -76.30565504809337, y: 41.21778496363833, z: 0 }
// EPSG.io output -76.3053142, 41.217868
// gdaltransform -s_srs EPSG:32028 -t_srs EPSG:4326
// 2397350 386280
// -76.3053143354412 41.2178680673729 0
What versions of GDAL/PROJ are you running?
$ gdalinfo --version
# GDAL 2.3.1, released 2018/06/22
$ proj
# Rel. 5.1.0, June 1st, 2018
gdalinfo --version
GDAL 2.2.4, released 2018/03/19
proj
Rel. 4.9.3, 15 August 2016
I think the bundled version of GDAL is the root of the problem. If I configure node-gdal to use my local install of gdal (npm install gdal --build-from-source --shared_gdal
), the result matches what I get from gdaltransform
.
Source | x | y |
---|---|---|
bundled gdal | -76.30565504809337 |
41.21778496363833 |
shared gdal | -76.30531433544122 |
41.21786806737292 |
gdaltransform | -76.3053143354412 |
41.2178680673729 |
$ proj
Rel. 5.1.0, June 1st, 2018
gdalinfo --version
GDAL 2.3.1, released 2018/06/22
I agree, trying the same test with Ubuntu 17.04 and linking against shared libgdal produced the correct output for me as well.