Turfjs / turf

A modular geospatial engine written in JavaScript and TypeScript

Home Page:https://turfjs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example for creating custom builds for use in the browser

hupe13 opened this issue · comments

commented

I installed the modules I need:

npm install @turf/helpers
npm install @turf/boolean-point-in-polygon
npm install @turf/meta

The main.js:

module.exports = {
	helpers:                  require('@turf/helpers'),
	booleanPointInPolygon:    require('@turf/boolean-point-in-polygon').default,
	meta:                     require('@turf/meta')
};

Then I can use after browserify and loading the outTurf.js:

turf.helpers.point()
turf.booleanPointInPolygon()
turf.meta.flattenEach()

I spent a lot of time until this worked. Maybe it will help others.

Thanks for sharing! I will close this but it will still be searchable if people find it helpful.