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 | 1x 1x 1x 1x 32x 32x 32x 15x 8x 15x 4x | const _ = require('lodash') const debug = process.env.KOOP_LOG_LEVEL === 'debug' || process.env.LOG_LEVEL === 'debug' const esriLookup = { Point: 'esriGeometryPoint', MultiPoint: 'esriGeometryMultipoint', LineString: 'esriGeometryPolyline', MultiLineString: 'esriGeometryPolyline', Polygon: 'esriGeometryPolygon', MultiPolygon: 'esriGeometryPolygon', esriGeometryPoint: 'esriGeometryPoint', esriGeometryMultipoint: 'esriGeometryMultipoint', esriGeometryPolyline: 'esriGeometryPolyline', esriGeometryPolygon: 'esriGeometryPolygon' } module.exports = function getGeometryTypeFromGeojson ({ geometryType, metadata = {}, features = [] } = {}) { const type = geometryType || metadata.geometryType || findInFeatures(features) Iif (!type && debug) { console.log(`Input JSON has unsupported geometryType: ${type}`) } return esriLookup[type] } function findInFeatures (features) { const featureWithGeometryType = features.find(feature => { return _.get(feature, 'geometry.type') }) if (!featureWithGeometryType) return return featureWithGeometryType.geometry.type } |