Guest User

Untitled

a guest
Sep 20th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. dom = new JSDOM(`<!DOCTYPE html>`, {
  2. userAgent: "webkit",
  3. });
  4. // Lie to leafletPip. By putting window, navigator, document, and $ on global, it now thinks we are in a browser.
  5. global.window = dom.window;
  6. global.navigator = global.window.navigator;
  7. global.document = global.window.document;
  8. $ = require('jquery')(global.window);
  9.  
  10.  
  11. L = require('leaflet'),
  12. leafletPip = require('@mapbox/leaflet-pip'),
  13.  
  14. containsLocation(coordinates, geojson) {
  15. var thing = leafletPip.pointInLayer([this.longitude,this.latitude], L.geoJson(geojson), true);
  16. // function isContained(element){
  17. // if (element) {
  18. // return true;
  19. // } else {
  20. // return false;
  21. // }
  22. // }
  23. // let polygons = _.map(_.map(geojson.features, "geometry"), "coordinates");
  24. // let thing = polygons.find(isContained)
  25. return !!thing.length;
  26. }
Add Comment
Please, Sign In to add comment