node-mapnik icon indicating copy to clipboard operation
node-mapnik copied to clipboard

4.x can't use gdal plugin with /vsi paths

Open craigds opened this issue 3 years ago • 2 comments

node-mapnik's gdal plugin doesn't follow GDAL's virtual filesystem (/vsicurl or /vsis3) paths for some reason.

Background: here's a small TIF file in S3

root@cff8afe58600:/app# gdalinfo -nomd /vsicurl/https://kx-craig-misc-test-bucket.s3.ap-southeast-2.amazonaws.com/v4-8018-5194.tif
Driver: GTiff/GeoTIFF
Files: /vsicurl/https://kx-craig-misc-test-bucket.s3.ap-southeast-2.amazonaws.com/v4-8018-5194.tif
Size is 8453, 16384
...

However, this minimal JS script using node-mapnik can't seem to load it:

root@cff8afe58600:/app# ./test-vsis3-url.js
ERROR 4: /vsicurl/https://kx-craig-misc-test-bucket.s3.ap-southeast-2.amazonaws.com/v4-8018-5194.tif: No such file or directory
[Error: /vsicurl/https://kx-craig-misc-test-bucket.s3.ap-southeast-2.amazonaws.com/v4-8018-5194.tif: No such file or directory  encountered during parsing of layer 'x' in Layer]

versions:

  • Tested (failing) with node-mapnik 4.0.0 and 4.5.9.
  • It previously worked fine for us using a really old version (1.4.15)

It looks like the gdal plugin is statically compiled these days (so no longer depends on having libgdal installed separately at runtime). Any idea what version of GDAL it's pulling in and how it's building it?

craigds avatar Feb 16 '23 06:02 craigds

Hi @craigds - right, I think the statically compiled GDAL linked into the plug-in is likely the limitation. My understanding is that VSI needs curl and linking curl statically would have been quite involved due to the need for OpenSSL for SSL support in curl.

So I doubt this is a GDAL version issue as much as how it was compiled in the binaries provided.

If fixing this is important, feel free to reach out to me by email to discuss.

springmeyer avatar Feb 16 '23 15:02 springmeyer

that makes sense, thanks. Is it possible to build it without static linking? I looked for docs on this but didn't find much yet. I'm not a JS native so forgive me if I've overlooked something really basic

craigds avatar Feb 16 '23 17:02 craigds