yocontra / node-gdal-next

Node.js bindings for GDAL (Geospatial Data Abstraction Library) [Fork]
https://contra.io/node-gdal-next/
Apache License 2.0
75 stars 36 forks source link

Fix #2, add `setPROJSearchPath`, fix windows not finding proj data. #32

Closed olivierchatry closed 3 years ago

olivierchatry commented 3 years ago

This add a stratic function setPROJSearchPath that call OSRSetPROJSearchPaths to define where PROJ will search for it data.

By default, it will be call with bundled path data if PROJ_LIB is not set.

This fix windows version sometimes not able to find proj.db ( and other files ).

yocontra commented 3 years ago

@olivierchatry Looks great - just needs to have some guards added for previous versions where this function didn't exist. Check the travis-ci results on the PR which are failing on all of the shared bindings (error: use of undeclared identifier 'OSRSetPROJSearchPaths'; did you mean 'setPROJSearchPath').

olivierchatry commented 3 years ago

Will fix as soon as I can.

yocontra commented 3 years ago

@olivierchatry I have an idea to simplify this a bit - why don't we keep what you originally had (always call setPROJSearchPath) and just make setPROJSearchPath no-op prior to gdal 3.0? It isn't needed or used in those versions anyways. All of the PROJ_LIB stuff was just in the recent releases, so we can keep the same behavior in 1.x/2.x by just ignoring it.

yocontra commented 3 years ago

Specifically just remove L22-28 in JS, and L214-215 in C++ and I think we're good to merge

olivierchatry commented 3 years ago

Done