How to use the @turf/helpers.round function in @turf/helpers

To help you get started, we’ve selected a few @turf/helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cheeaun / busrouter-sg / tasks / generateStops.js View on Github external
const fs = require('fs');
const toTitleCase = require('../utils/titleCase');
const { round } = require('@turf/helpers');

const stops = JSON.parse(fs.readFileSync('data/3/stops3.json'));

const stops3 = {};

for (number in stops){
  const { lat, lng, name, left } = stops[number];
  stops3[number] = [round(lng, 5), round(lat, 5), toTitleCase(name), left ? 1 : 0];
}

const filePath = 'data/3/stops.final.json';
fs.writeFileSync(filePath, JSON.stringify(stops3, null, '\t'));
console.log(`Generated ${filePath}`);
github cheeaun / busrouter-sg / visualization / build-stops.js View on Github external
  f.geometry.coordinates.forEach(c => round(c, 5));
  const feature = circle(f, .015, { steps: 3 });