UNPKG

@visactor/vdataset

Version:

data processing tool

43 lines (39 loc) 1.93 kB
"use strict"; var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) { void 0 === k2 && (k2 = k); var desc = Object.getOwnPropertyDescriptor(m, k); desc && !("get" in desc ? !m.__esModule : desc.writable || desc.configurable) || (desc = { enumerable: !0, get: function() { return m[k]; } }), Object.defineProperty(o, k2, desc); } : function(o, m, k, k2) { void 0 === k2 && (k2 = k), o[k2] = m[k]; }), __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function(o, v) { Object.defineProperty(o, "default", { enumerable: !0, value: v }); } : function(o, v) { o.default = v; }), __importStar = this && this.__importStar || function(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (null != mod) for (var k in mod) "default" !== k && Object.prototype.hasOwnProperty.call(mod, k) && __createBinding(result, mod, k); return __setModuleDefault(result, mod), result; }, __importDefault = this && this.__importDefault || function(mod) { return mod && mod.__esModule ? mod : { default: mod }; }; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.geoBufParser = void 0; const geobuf = __importStar(require("geobuf")), pbf_1 = __importDefault(require("pbf")), constants_1 = require("../../constants"), js_1 = require("../../utils/js"), geojson_1 = require("./geojson"), DEFAULT_GEOBUF_OPTIONS = {}, geoBufParser = (data, options = {}, dataView) => { dataView.type = constants_1.DATAVIEW_TYPE.GEO; const mergeOptions = (0, js_1.mergeDeepImmer)(geojson_1.DEFAULT_GEOJSON_OPTIONS, DEFAULT_GEOBUF_OPTIONS, options), geoData = geobuf.decode(new pbf_1.default(data)); return (0, geojson_1.geoJSONParser)(geoData, mergeOptions, dataView); }; exports.geoBufParser = geoBufParser; //# sourceMappingURL=geobuf.js.map