question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bbox-polygon v6.0.0 - helpers_1.polygon is not a function

See original GitHub issue

I just installed @turf/bbox-polygon and got v6.0.0. However upon using it I get the following error:

TypeError: helpers_1.polygon is not a function
bboxPolygon
node_modules/@turf/bbox-polygon/index.js:36

  33 | var topLeft = [west, north];
  34 | var topRight = [east, north];
  35 | var lowRight = [east, south];
> 36 | return helpers_1.polygon([[
  37 |         lowLeft,
  38 |         lowRight,
  39 |         topRight,

addLayers/<
src/components/Map.js:158

> 158 | const bboxData = bboxPolygon([
  159 |   layer.bounds.west, layer.bounds.south,
  160 |   layer.bounds.east, layer.bounds.north
  161 | ])

If I switch to v5.1.5 there’s no issue.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
alpha-beta-soupcommented, Mar 25, 2018

My bad: I also had the entire @turf/turf installed as a dependency, probably causing a conflict. Removing that in favour of the specific packages I need, and there’s no issue. Thanks, and great work on v6.0.0 👍

1reaction
DenisCarrierecommented, Mar 23, 2018

@alpha-beta-soup Seems to work on my side, must be something with your build.

Can you provide your build setup and a sample code of how you are using the module.

The following works for me:

install

$ yarn install @turf/bbox-polygon

CommonJS - test.js

const bboxPolygon = require('@turf/bbox-polygon').default
const poly = bboxPolygon([-180, -90, 180, 90])
console.log(poly)
$ node test.js
{ type: 'Feature',
  bbox: [ -180, -90, 180, 90 ],
  properties: {},
  geometry: { type: 'Polygon', coordinates: [ [Array] ] } }

Typescript - test.ts

import bboxPolygon from '@turf/bbox-polygon'
const poly = bboxPolygon([-180, -90, 180, 90])
console.log(poly)
$ ts-node test.ts
{ type: 'Feature',
  bbox: [ -180, -90, 180, 90 ],
  properties: {},
  geometry: { type: 'Polygon', coordinates: [ [Array] ] } }

Going to close the issue unless there’s more information provided by @alpha-beta-soup

Read more comments on GitHub >

github_iconTop Results From Across the Web

Advanced geospatial analysis - Turf.js
Takes two (Multi)Polygon(s) and returns a combined polygon. If the input polygons are not contiguous, this function returns a MultiPolygon feature. Arguments ...
Read more >
Uncaught TypeError: o.intersection is not a function in turf.js
I think turf.intersect() takes only single features with Polygon geometry as arguments. You should separate your layers into individual ...
Read more >
Javascript error when determining if a point falls within a ...
Using Google Maps API v3. Here is the JS: function drawPolygon() { var polygon = new google.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found