mapbox / polylabel

A fast algorithm for finding the pole of inaccessibility of a polygon (in JavaScript and C++)
Other
1.44k stars 151 forks source link

Javascript Usage #52

Open anbinhou opened 5 years ago

anbinhou commented 5 years ago

Hi there,

I might be too stupid to use it in javascript. Just wondering how I should use it in my javascript/html so that I can avoid the error information of 'request is not defined' or 'Queue is not a constructor'?

Regards,

chartinger commented 5 years ago

For a quick fix you could use Parcel

mstrop commented 5 years ago

I have the same issue. Following chartinger approach, I get error

× No entries found. at Bundler.bundle (C:\Users\marek\AppData\Roaming\npm\node_modules\parcel-bundler\src\Bundler.js:275:17) at

when running parcel build polylabel.js

mourner commented 5 years ago

Here's a browser build that you can use from a CDN: https://bundle.run/@mapbox/polylabel@1.0.2

I should update the readme about this.

mstrop commented 5 years ago

Here's a browser build that you can use from a CDN: https://bundle.run/@mapbox/polylabel@1.0.2

I should update the readme about this.

Thanks a lot. In case anybody else has the same issue, finally Browserify ( http://browserify.org/#install ) worked for me ( you just replied quiker than I was able to post my solution ;) ).

Thirdhuman commented 5 years ago

@mstrop can you share your code here? I'm struggling with the same issue.

rullymartanto commented 4 years ago

I have load the library

import * as polylabel from 'polylabel';

still module not found

HugoP27 commented 3 years ago

I had the same issue and fixed it by including this polylabel.zip js file in my project and including this script tag in my html: Problem sorted