Skip to content

Commit

Permalink
Added code to compute total land area within each buffer and store it…
Browse files Browse the repository at this point in the history
… in the GeoJson as per #5
  • Loading branch information
Chris Slatt committed Aug 22, 2016
1 parent d5cca36 commit b9cb67f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/generate-buffers.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ function done(error, name) {
function generateBuffer(geojson, distanceInMiles, fileName) {
console.log('generating ' + fileName);
var buffer = turf.buffer(geojson, distanceInMiles, 'miles');
var areaInSqMeters = turf.area(buffer);
var areaInSqKm = areaInSqMeters / 1000000;
var areaInSqMiles = areaInSqKm / 2.58999;
buffer.area = areaInSqMiles;

fs.writeFileSync(path.resolve('buffers', fileName), JSON.stringify(buffer));
}

Expand Down

0 comments on commit b9cb67f

Please sign in to comment.