node-gdal-async icon indicating copy to clipboard operation
node-gdal-async copied to clipboard

Can't find supporting CSV files in monorepo

Open bkeepers opened this issue 2 months ago • 1 comments

When using gdal-async in a monorepo setup with workspaces, the S57 driver can't find the necessary CSV files without explicitly setting S57_CSV environment variable.

I have created a repository that reproduces this issue. It contains a simple monorepo with a single package that uses gdal-async to open an S57 dataset to demonstrate.

Steps to reproduce:

  1. package.json with workspaces field.
  2. packages/subdir/package.json depending on gdal-async.
  3. packages/subdir/ogrinfo.js script that opens an S57 dataset.

Expected result

Layers have names from the mapping files:

1: DSID (None)
2: ADMARE (Polygon)
3: BCNSPP (Point)
...
54: C_ASSO (None)

Actual result

0: DSID
1: Point
2: Line
3: Area
4: Meta

Workaround

Setting the S57_CSV environment variable to point to the gdal-async S57 CSV files resolves the issue.

export S57_CSV=node_modules/gdal-async/deps/libgdal/gdal/ogr/ogrsf_frmts/s57/data/

Reproduction

Clone the repo and run:

sh repro.sh

Here is the output:

Expected output with ogrinfo:
INFO: Open of `ENC_ROOT/US1AK90M/US1AK90M.000'
      using driver `S57' successful.
1: DSID (None)
2: ADMARE (Polygon)
3: BCNSPP (Point)
4: BUISGL
5: BUAARE
6: BOYSPP (Point)
7: CBLSUB
8: CTNARE
9: COALNE
10: CONZNE (Polygon)
11: CTRPNT (Point)
12: DAYMAR (Point)
13: DEPARE
14: DEPCNT
15: DMPGRD
16: EXEZNE (Polygon)
17: FSHZNE (Polygon)
18: LAKARE (Polygon)
19: LNDARE
20: LNDELV
21: LNDRGN
22: LNDMRK
23: LIGHTS (Point)
24: MAGVAR
25: MORFAC
26: OBSTRN
27: OFSPLF
28: PILPNT (Point)
29: PILBOP
30: PRCARE
31: PRDARE
32: RTPBCN (Point)
33: RDOSTA (Point)
34: RESARE (Polygon)
35: RIVERS
36: SEAARE
37: SBDARE
38: SLCONS
39: SILTNK
40: SLOTOP
41: SLOGRD
42: SOUNDG (3D Multi Point)
43: TESARE (Polygon)
44: TWRTPT (Polygon)
45: UWTROC (Point)
46: UNSARE (Polygon)
47: WATTUR
48: WRECKS
49: M_COVR (Polygon)
50: M_NPUB (Polygon)
51: M_NSYS (Polygon)
52: M_QUAL (Polygon)
53: M_SDAT (Polygon)
54: C_ASSO (None)



========================



node-gdal-async output:
0: DSID
1: Point
2: Line
3: Area
4: Meta



========================



node-gdal-async with S57_CSV output:
0: DSID
1: ADMARE
2: BCNSPP
3: BUISGL
4: BUAARE
5: BOYSPP
6: CBLSUB
7: CTNARE
8: COALNE
9: CONZNE
10: CTRPNT
11: DAYMAR
12: DEPARE
13: DEPCNT
14: DMPGRD
15: EXEZNE
16: FSHZNE
17: LAKARE
18: LNDARE
19: LNDELV
20: LNDRGN
21: LNDMRK
22: LIGHTS
23: MAGVAR
24: MORFAC
25: OBSTRN
26: OFSPLF
27: PILPNT
28: PILBOP
29: PRCARE
30: PRDARE
31: RTPBCN
32: RDOSTA
33: RESARE
34: RIVERS
35: SEAARE
36: SBDARE
37: SLCONS
38: SILTNK
39: SLOTOP
40: SLOGRD
41: SOUNDG
42: TESARE
43: TWRTPT
44: UWTROC
45: UNSARE
46: WATTUR
47: WRECKS
48: M_COVR
49: M_NPUB
50: M_NSYS
51: M_QUAL
52: M_SDAT
53: C_ASSO

bkeepers avatar Oct 24 '25 15:10 bkeepers