How to use the alasql.aggr function in alasql

To help you get started, we’ve selected a few alasql 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 koopjs / winnow / src / sql.js View on Github external
coordinates: projectCoordinates(geometry.coordinates, { toSR: projection })
    }
  } catch (e) {
    return null
  }
}

sql.fn.reducePrecision = function (geometry, precision) {
  if (!(geometry && geometry.coordinates)) return geometry
  return {
    type: geometry.type,
    coordinates: reducePrecision(geometry.coordinates, precision)
  }
}

sql.aggr.hash = function (value, obj, acc) {
  obj = obj || {}
  if (obj[value]) obj[value]++
  else obj[value] = 1
  return obj
}

/**
 * Modify propterties to fit ESRI specs
 * @param {object} properties GeoJSON properties
 * @param {object} geometry GeoJSON geometry
 * @param {string} dateFields comma-delimited list of date fields
 * @param {string} requiresObjectId boolean-string flagging requirement of OBJECTID as part of properties
 * @param {string} idField name of attribute to be used as OBJECTID
 */
function esriFy (properties, geometry, dateFields, requiresObjectId, idField) {
  const parsedDateFields = (dateFields.length === 0) ? [] : dateFields.split(',')

alasql

Use SQL to select and filter javascript data - including relational joins and search in nested objects (JSON). Export to and import from Excel and CSV

MIT
Latest version published 8 days ago

Package Health Score

89 / 100
Full package analysis