Skip to content

Commit

Permalink
set the grib resource dir path
Browse files Browse the repository at this point in the history
  • Loading branch information
mmomtchev committed Jun 14, 2024
1 parent 31d861d commit 46ed41f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/gdal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ const binary = require('@mapbox/node-pre-gyp')
const binding_path = binary.find(path.resolve(path.join(__dirname, '../package.json')))
const gdal = require(binding_path)

const data_path = path.resolve(__dirname, '../deps/libgdal/gdal/data')
const proj_path = path.resolve(__dirname, '../deps/libproj/proj/data')
const data_path = path.resolve(__dirname, '..', 'deps', 'libgdal', 'gdal', 'data')
const proj_path = path.resolve(__dirname, '..', 'deps', 'libproj', 'proj', 'data')
const grib_resource_path = path.resolve(__dirname, '..', 'deps', 'libgdal', 'gdal', 'frmts', 'grib', 'data')

if (process.env.GDAL_DATA === undefined && !fs.existsSync(data_path)) {
throw new Error(
Expand Down Expand Up @@ -80,6 +81,12 @@ if (process.env.CURL_CA_BUNDLE === undefined && gdal.bundled) {
gdal.config.set('CURL_CA_BUNDLE', path.resolve(__dirname, '../deps/libcurl/cacert.pem'))
}

if (fs.existsSync(grib_resource_path)) {
gdal.config.set('GRIB_RESOURCE_DIR', grib_resource_path)
} else {
console.warn('GRIB resources files not found in ', grib_resource_path)
}

/**
* Callback using the standard Node.js error convention
* @callback callback
Expand Down

0 comments on commit 46ed41f

Please sign in to comment.