Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 1x 1x 3x 3x 3x 3x 3x 840x 3x 1x | /** **************************************************************************************************** * File: GeohashStreamGeoJSON.js * Project: geohash * @author Nick Soggin <iSkore@users.noreply.github.com> on 12-Feb-2019 *******************************************************************************************************/ 'use strict'; const GeohashStream = require( './GeohashStream' ), toGeoJSON = require( './toGeoJSON' ); class GeohashStreamGeoJSON extends GeohashStream { /** * GeohashStreamGeoJSON * * extends GeohashStream * * @param {object} opts - configuration object * @param {number} opts.minLng - bbox min longitude * @param {number} opts.minLat - bbox min latitude * @param {number} opts.maxLng - bbox max longitude * @param {number} opts.maxLat - bbox max latitude * @param {number} opts.precision - geohash precision * @param {boolean} [opts.includeGeohashAsProperty=false] * include geohash string as a property in the GeoJSON * @param {boolean} [opts.includeFeatureBBox=false] * include bbox as a property in the GeoJSON */ constructor( opts ) { super( opts ); this.opts = opts; this.opts.includeGeohashAsProperty = this.opts.includeGeohashAsProperty || false; this.opts.includeFeatureBBox = this.opts.includeFeatureBBox || false; } _read() { let chunk; while ( ( chunk = super.nextChunk() ) !== null ) { this.push( JSON.stringify( toGeoJSON( chunk, this.opts ) ) ); } this.push( null ); } } module.exports = GeohashStreamGeoJSON; |