wavded / ogr2ogr

An ogr2ogr wrapper library
MIT License
214 stars 46 forks source link

ogr2ogr is not a function #90

Closed bertday closed 1 year ago

bertday commented 1 year ago

Thank you for this awesome tool! I'm excited to use it in my geodata wrangling :)

I tried following the instructions in README.md and got an error:

Uncaught TypeError TypeError: ogr2ogr is not a function

Here is my code:

import ogr2ogr from 'ogr2ogr';

(async () => {
  const { data } = await ogr2ogr('/path/to/a.shp');
  console.log(data);
})();

and indeed when I console.log(ogr2ogr) I get an object:

{default: ƒ, __esModule: true}

The following works, if I access that default property by name:

const { data } = await ogr2ogr.default('/path/to/data');

Also, I made sure my package.json has the old "type": "module" to enable ES6 imports.

Is there anything I'm doing that may be causing my install to behave a bit differently than what's in the README? Would appreciate any pointers on this!!!

wavded commented 1 year ago

Thx for reporting. This is fixed in v4.0.0