Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dom = new JSDOM(`<!DOCTYPE html>`, {
- userAgent: "webkit",
- });
- // Lie to leafletPip. By putting window, navigator, document, and $ on global, it now thinks we are in a browser.
- global.window = dom.window;
- global.navigator = global.window.navigator;
- global.document = global.window.document;
- $ = require('jquery')(global.window);
- L = require('leaflet'),
- leafletPip = require('@mapbox/leaflet-pip'),
- containsLocation(coordinates, geojson) {
- var thing = leafletPip.pointInLayer([this.longitude,this.latitude], L.geoJson(geojson), true);
- // function isContained(element){
- // if (element) {
- // return true;
- // } else {
- // return false;
- // }
- // }
- // let polygons = _.map(_.map(geojson.features, "geometry"), "coordinates");
- // let thing = polygons.find(isContained)
- return !!thing.length;
- }
Add Comment
Please, Sign In to add comment