You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I never encountered any problem to build and to use some Turf custom builds before but it appears that a function appears has not defined if it is part of a module whose the name contains a hyphen, e.g. hex-grid (or any other *-grid), bbox-polygon, etc.
Here is a simple example based on npm runkit (here hex-grid):
var hexGrid = require("@turf/hex-grid")
var bbox = [-96,31,-84,40];
var cellSide = 50;
var options = {units: 'miles'};
var hexgrid = hexGrid(bbox, cellSide, options);
var addToMap = [hexgrid];
It appears that "hexGrid is not a function". The same problem when a custom build is created with only the hex-grid module in it.
Thanks for your support.
Lewis
The text was updated successfully, but these errors were encountered:
I managed to solve this problem by myself. Sorry to have created an issue about it.
The hexgrid function as well as some other ones are only exported using the default option, i.e. export default hexGrid. Therefore it needs to be called slightly differently as users of these different modules need to add "default" to access it, for example:
It would maybe be good to add this use case in this part of the Turf documentation (Step 2) and to create a list somewhere to know which module relies only on the default export such as hex-grid, square-grid, bbox-polygon, etc.
LewisRob
changed the title
Custom builds: problem to call some the functions which are part of a module/package which contains a hyphen in their name
Custom builds: problem to call the functions which are defined using a default export only
Sep 6, 2018
Yeah unfortunately there was a change to bundling in v6 which had some flow on impacts were which never got communicated via the docs. We're currently working on a bit of an overhaul for v7 which will then get fully documented.
Hi,
Thanks for this great spatial library.
I never encountered any problem to build and to use some Turf custom builds before but it appears that a function appears has not defined if it is part of a module whose the name contains a hyphen, e.g. hex-grid (or any other *-grid), bbox-polygon, etc.
Here is a simple example based on npm runkit (here hex-grid):
It appears that "hexGrid is not a function". The same problem when a custom build is created with only the hex-grid module in it.
Thanks for your support.
Lewis
The text was updated successfully, but these errors were encountered: