Turf playground
by Stefano
HTML
<script src="https://npmcdn.com/@turf/turf/turf.min.js"></script>
<div id="output"></div>
JavaScript
var grid = turf.polygon([[
[
-96.42846501760152,
-47.874074822480466
],
[
37.165121096735334,
-36.1861505177017
],
[
36.29356366925875,
-26.22420353678424
],
[
-87.33807546416065,
-37.04057041408643
],
[
-91.99343795333672,
16.17046632550918
],
[
-101.95538493425417,
15.2989088980326
],
[
-96.42846501760152,
-47.874074822480466
]
]])
display(grid);
/* output function */
function display(data, target) {
target = target || 'output';
var el = document.getElementById(target);
// if not available create target element
if (!el) {
el = document.createElement('div');
el.setAttribute("id", target);
document.body.appendChild(el);
}
// inject text
var json = JSON.stringify(data, null, '\t');
document.getElementById(target).innerHTML = json;
}