Skip to content

Instantly share code, notes, and snippets.

@dschep
Created August 21, 2019 01:12
Show Gist options
  • Save dschep/92bc5f308b8506a774ecc9482795ccdf to your computer and use it in GitHub Desktop.
Save dschep/92bc5f308b8506a774ecc9482795ccdf to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"features": [
{
"geometry": {
"coordinates": [
[
[
-76.99545991625094,
38.8494249445368
],
[
-76.99545897271584,
38.84940753118869
],
[
-76.9954995690582,
38.84941110911011
],
[
-76.9955429301827,
38.84941513754488
],
[
-76.99554474972979,
38.84942502887962
],
[
-76.99554894245898,
38.849434028469446
],
[
-76.99555748980451,
38.84944232556661
],
[
-76.99559414523284,
38.84946354182745
],
[
-76.9956238200663,
38.849476172773635
],
[
-76.99566166278737,
38.84948600239161
],
[
-76.9956849331005,
38.8494886967767
],
[
-76.99568335292349,
38.84952065865733
],
[
-76.99568210722792,
38.849545981331154
],
[
-76.99567179673757,
38.84954677369208
],
[
-76.99563647575613,
38.84955522229285
],
[
-76.9956026752499,
38.849566319420994
],
[
-76.99556674305035,
38.84958503759716
],
[
-76.99552995783306,
38.84961198043355
],
[
-76.99550844851454,
38.84963377102011
],
[
-76.99550178928415,
38.849643851206025
],
[
-76.99545996022628,
38.84963927330097
],
[
-76.99541906429234,
38.84963479451038
],
[
-76.99543012566868,
38.84960170695054
],
[
-76.99545371333328,
38.84950573197049
],
[
-76.9954587728921,
38.849470175861356
],
[
-76.99545991625094,
38.8494249445368
]
]
],
"type": "Polygon"
},
"properties": {
"CAPTUREACTION": "A",
"CAPTUREDATE": "2015-04-24T00:00:00.000Z",
"CAPTUREYEAR": "2015-04-24T00:00:00.000Z",
"DESCRIPTION": "Intersection",
"FEATURECODE": 1090,
"GIS_ID": null,
"OBJECTID": 36745,
"Shape_Area": 340.46359750661827,
"Shape_Length": 82.00077153373488
},
"type": "Feature"
},
{
"geometry": {
"coordinates": [
[
[
-76.99536668936604,
38.84938404680359
],
[
-76.99537445676039,
38.84932262793409
],
[
-76.99539746044677,
38.84926356930727
],
[
-76.99543481640643,
38.849209140521666
],
[
-76.99548508907083,
38.84916143325782
],
[
-76.99554634648962,
38.84912228089432
],
[
-76.99561623457457,
38.84909318804969
],
[
-76.99569206756576,
38.84907527275851
],
[
-76.9957709312439,
38.84906922350396
],
[
-76.99584979492202,
38.84907527275851
],
[
-76.99592562791321,
38.84909318804969
],
[
-76.99599551599817,
38.84912228089432
],
[
-76.99605677341697,
38.84916143325782
],
[
-76.99610704608136,
38.849209140521666
],
[
-76.99614440204103,
38.84926356930727
],
[
-76.9961674057274,
38.84932262793409
],
[
-76.99617517312176,
38.84938404680359
],
[
-76.9961674057274,
38.84944546562008
],
[
-76.99614440204103,
38.84950452409587
],
[
-76.99610704608136,
38.84955895265547
],
[
-76.99605677341697,
38.84960665965272
],
[
-76.99599551599817,
38.84964581174963
],
[
-76.99592562791321,
38.84967490436825
],
[
-76.99584979492202,
38.84969281950841
],
[
-76.9957709312439,
38.849698868709936
],
[
-76.99569206756576,
38.84969281950841
],
[
-76.99561623457457,
38.84967490436825
],
[
-76.99554634648962,
38.84964581174963
],
[
-76.99548508907083,
38.84960665965272
],
[
-76.99543481640643,
38.84955895265547
],
[
-76.99539746044677,
38.84950452409587
],
[
-76.99537445676039,
38.84944546562008
],
[
-76.99536668936604,
38.84938404680359
]
]
],
"type": "Polygon"
},
"properties": {},
"type": "Feature"
}
],
"type": "FeatureCollection"
}
const turf = require('@turf/turf');
const data = require('./data.json');
console.log(turf.intersect(data.features[0], data.features[1]))
@AkshayGore
Copy link

please share your complete code. akshaygore.36@gmail.com

@dschep
Copy link
Author

dschep commented Aug 21, 2019

@AkshayGore this is the full code to reproduce the error. You'll see the console.log prints null rather than the overlapping area.

@plarner30
Copy link

Can replicate starting with version 5.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment