Importing Data

Data, data everywhere. But not a bit to bite.

Supported Data Formats

WebGeoDa currently supports GeoJSON files for geospatial data. Geospatial files must have some kind of feature or geographic ID column. You can import tabular data from CSV or from our csv-like Protobuffer schema.

Future versions plan to enable Shapefile and Geobuf geospatial data support, as well as connections to simple backends like Google Sheets. In the future, we'll connect with more proper backends.

Importing GeoJSON

To import a GeoJSON, first add your file to public/geojson. Next open map-config.js in the root directory using your code editor of choice. An example of how you can declare data will greet you there -- you'll see something like this:

const data = [
    {
        name: 'Texas Block Groups', // Plain english name for dataset
        geodata: 'tx.geojson', // geospatial data to join to
        id:'GEOID', // fid / geoid join column
        tables: {} // any additional tabular data
    }
]

Each geospatial dataset you'll add will need to an object in data. Here's the (case sensitive) defails on how this should look:

  • name: What a human would call your data

  • geojson: The name of the GeoJSON file in public/geojson

  • id: The join column or feature ID column of your data to join additional tables (commonly, FIPS, GEOID, etc)

  • tables: A list of tables you'd like to join on-the-fly to your data - more below

Joining additional tables in the browser means that data can be much better optimized for file transfer size, while still only needing simple, static server requirements. Each table you add in the tables property of your data will load with your GeoJSON file if they are in your default variable, or will lazy load after the initial map view. Don't want to keep those users waiting 🤠

Joining Tables

To add tables, be sure to add your CSV file(s) to the public/csv folder. Then, you can add entries to each geospatial data's tables property:

const data = [
    {
        name: 'Texas Block Groups',
        ...
        tables: {
            acs_data: { // data table name
                file:'texas_acs.csv',
                type:'characteristic',
                id:'FIPS'
            }
        }
    }
]
  • Date Table Name (as a property in tables): The name you'd like to refer to this data elsewhere

  • file: The name of the tabular data file in public/csv

  • type: The type of data included - characteristic for simple columns of data, time-series or time-series-cumulative if you'd like a timeline

  • id: The join column that should reference your geospatial data

  • dates: If using time-series data, specify whether your dates are an ISO date format (YYYY-MM-DD) or US date format (MM/DD/YYYY)

If your GeoJSONs are larger than ~5MB and have a large number of features, we strongly recommend separating out your tabular data. Avoid tabular data in GeoJSON means that the property keys won't get duplicated, and file transfer / parsing time will be reducing.

You can also import Protobuffer files using our csv-like schema, allowing for even smaller files when data are particularly large. You can read more about their usage in the advanced docs.

Last updated