Skip to content

Instantly share code, notes, and snippets.

@morganherlocker
Created October 30, 2015 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morganherlocker/bc6a1814492f82af6a55 to your computer and use it in GitHub Desktop.
Save morganherlocker/bc6a1814492f82af6a55 to your computer and use it in GitHub Desktop.
var poly = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
51.17431640625,
47.025206001585396
],
[
45.17578125,
43.13306116240612
],
[
54.5361328125,
41.85319643776675
],
[
51.17431640625,
47.025206001585396
]
]
]
}
}
var line = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[
42.78076171875,
46.01222384063236
],
[
56.865234375,
44.26093725039923
]
]
}
}
var intersection = turf.lineDistance(turf.intersect(poly, line), 'miles');
//=intersection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment