npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

keplergl-dataset-builder

v1.1.0

Published

A small untility for assembling datasets for use with the kepler.gl geospatial analysis library

Downloads

14

Readme

keplergl-dataset-builder

Created to assist in working with the kepler.gl geospacial analysis library.

Installation

npm install --save keplergl-dataset-builder

To add the module to you project

Usage

Import the utility using the javascipt module syntax:

import keplerglDatasetBuilder from 'keplergl-dataset-builder';

Basic syntax to call the function

keplerglDatasetBuilder([[dataID, dataset],[...]], processorfunction)

Contextual example:

addDataToMap({
    datasets: keplerglDatasetBuilder(
        [
            ['oitev24ys', file1Data],
            ['o8c48j893', file2Data]
        ],
        processCsvData
    ),
    config
})

In this example file1Data and file2Data are the results of fetchedCsvFile.text() and they will processed by the processCsvData function as well as having their respective ID strings assigned to them.

The returned array looks like this and can be imported by kepler.gl using its function addDataToMap.

[
  {
    info: { id: 'oitev24ys' },
    data: { processCsvData(file1Data) }
  },
  {
    info: { id: 'o8c48j893' },
    data: { processCsvData(file2Data) }
  }
]

Function Arguments

Raw data array

2 Dimmensional of data to be processed: [dataID, dataset] | dataID | dataset | | ----------- | ----------- | | 9 character alphanumeric ID assigned to that dataset. It is nessessary to assign IDs to datasets if a config containing a layer style is also being added to kepler. | As mentioned before, this is the dataset that you want to load. Usually this will be the result of fetching/importing data from an external source and in the case of a csv at least, running a .text() method on it. |

Processor function

The kepler.gl library has built in functions for converting imported data files into a format that kepler can ingest. These include processCsvData which is used in the above example. If nothing is included for the processorFunction argument, whatever was passed in for the dataset will be included in the result unprocessed. This would be desirable is the data is already in a processed format that kepler can handle but has no dataID included.

Motivation

A small utility for easily building dataset objects to pass into the kepler.gl geospacial analysis library.

For use mainly when fetching data from an remote location such as amazon S3, that needs to be processed before importing into kepler.gl. If you are loading local data that is stored in objects that already contain the data in a processed form including the dataId and title that kepler.gl can easily ingest then there should be no need for this utility.

This utility has only been tested with remotly fetched csv files and that is what the examples will show. There is no gaurantee it will work with json or geojson files. Support for the other forms of data that kepler can accept may come in the future.