bts-gov/access-to-intercity-air-bus-and-rail-m2bh-93w3
Icon for Socrata external plugin

Query the Data Delivery Network

Query the DDN

The easiest way to query any data on Splitgraph is via the "Data Delivery Network" (DDN). The DDN is a single endpoint that speaks the PostgreSQL wire protocol. Any Splitgraph user can connect to it at data.splitgraph.com:5432 and query any version of over 40,000 datasets that are hosted or proxied by Splitgraph.

For example, you can query the access_to_intercity_air_bus_and_rail table in this repository, by referencing it like:

"bts-gov/access-to-intercity-air-bus-and-rail-m2bh-93w3:latest"."access_to_intercity_air_bus_and_rail"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "var_num", -- Variation number
    "var", -- Variation description
    "hh_v0ct", -- Rural households with no access to household vehicle
    "v0anyct", -- Rural households with no access to household vehicle but access to any intercity mode
    "povct", -- Rural households below poverty
    "povanyct", -- Rural households below poverty and access to any intercity mode
    "uempct", -- Civilian labor force in rural areas that is unemployed
    "uemraict", -- Civilian labor force in rural areas that is unemployed and has access to intercity rail transportation
    "uembusct", -- Civilian labor force in rural areas that is unemployed and has access to intercity bus transportation
    "uemailct", -- Civilian labor force in rural areas that is unemployed and has access to medium or large hub airport
    "uemairct", -- Civilian labor force in rural areas that is unemployed and has access to air transportation
    "v0railct", -- Rural households with no access to household vehicle but access to intercity rail transportation
    "v0busct", -- Rural households with no access to household vehicle but access to intercity bus transportation
    "v0airlct", -- Rural households with no access to household vehicle but access to medium or large hub airport
    "v0airct", -- Rural households with no access to household vehicle but access to air transportation
    "povbusct", -- Rural households below poverty and access to intercity bus transportation
    "povailct", -- Rural households below poverty and access to medium or large hub airport
    "povairct", -- Rural households below poverty and access to air transportation
    "l25kct", -- Rural households with income less than $25,000
    "l25raict", -- Rural households with income less than $25,000 and access to intercity rail transportation
    "l25busct", -- Rural households with income less than $25,000 and access to intercity bus transportation
    "l25ailct", -- Rural households with income less than $25,000 and access to medium or large hub airport
    "l25airct", -- Rural households with income less than $25,000 and access to air transportation
    "l10kct", -- Rural households with income less than $10,000
    "l10raict", -- Rural households with income less than $10,000 and access to intercity rail transportation
    "l10airlct", -- Rural households with income less than $10,000 and access to medium or large hub airport
    "l10airct", -- Rural households with income less than $10,000 and access to air transportation
    "p65ct", -- Rural population 65 and over
    "p65railct", -- Rural population 65 and over with access to intercity rail transportation
    "p65busct", -- Rural population 65 and over with access to intercity bus transportation
    "p65airlct", -- Rural population 65 and over with access to medium or large hub airport
    "p65airct", -- Rural population 65 and over with access to air transportation
    "uempanyct", -- Civilian labor force in rural areas that is unemployed and has access to any intercity mode
    "l25anyct", -- Rural households with income less than $25,000 and access to any intercity mode
    "l10anyct", -- Rural households with income less than $10,000 and access to any intercity mode
    "p65_anyct", -- Rural population 65 and over with access to any intercity mode
    "lf_air", -- Civilian labor force with access to air service.
    "lf_rail", -- Civilian labor force in rural areas with access to intercity rail transportation.
    "lf_bus", -- Civilian labor force in rural areas with access to intercity bus transportation.
    "lf_airl", -- Civilian labor force in rural areas with access to medium or large hub airport.
    "lf_any", -- Civilian labor force in rural areas with access to intercity transportation.
    "hh_rail", -- Households in rural areas with access to intercity rail transportation.
    "hh_bus", -- Households in rural areas with access to intercity bus transportation.
    "hh_airl", -- Households in rural areas with access to medium or large hub airport.
    "hh_air", -- Households in rural areas with access to air service.
    "hh_any", -- Households in rural areas with access to intercity transportation
    "v0", -- Percent of zero vehicle households in rural areas
    "v0_rail", -- Percent of zero vehicle households in rural areas with access to rail transportation
    "v0_bus", -- Percent of zero vehicle households in rural areas with access to intercity bus transportation
    "v0_airl", -- Percent of zero vehicle households in rural areas with access to medium or large hub airport
    "v0_air", -- Percent of zero vehicle households in rural areas with access to air service
    "v0_any", -- Percent of zero households in rural areas with access to intercity transportation
    "bin_v0", -- Bin used for mapping percent of zero vehicle households in rural areas (998=no rural population, 999=no population data, 0=0, 1=1 to 4.9%, 2=5 to 9.9%, 3=10 to 14.9%, 4=15 to 19.9%, 5=20 to 24.9%, 6=25% or more)
    "bin_l25k", -- Bin used for mapping percent of households in rural areas with in income less than 25,000 (998=no rural population, 999=no population data, 0=0, 1=1 to 4.9%, 2=5 to 9.9%, 3=10 to 14.9%, 4=15 to 19.9%, 5=20 to 24.9%, 6=25% or more)
    "l25k", -- Percent of households in rural areas with income less than 25,000
    "l25k_rail", -- Percent of households in rural areas with access to intercity rail transportation and income less than 25,000 (2018 inflation adjusted dollars)
    "l25k_bus", -- Percent of households in rural areas with access to intercity bus transportation and income less than 25,000 (2018 inflation adjusted dollars)
    "l25kairl", -- Percent of households in rural areas with access to medium or large hub airport and income less than 25,000 (2018 inflation adjusted dollars)
    "l25k_air", -- Percent of households in rural areas with access to air service and income less than 25,000 (2018 inflation adjusted dollars)
    "l25k_any", -- Percent of households in rural areas with access to intercity transportation and income less than 50,000 (2018 inflation adjusted dollars)
    "p65_any", -- Percent 65 and older in rural areas with access to intercity transportation
    "bin_uemp", -- Bin used for mapping percent of civilian labor force in rural areas unemployed  (998=no rural population, 999=no population data, 0=0%, 1=less than 5%, 2=5 to 9.9%, 3=10 to 14.9%, 4=15 to 19.9%, 5=20 to 24.9%, 6=25% or more)
    "bin_l10k", -- Bin used for mapping households in rural areas with income less than 10,000  (998=no rural population, 999=no population data, 0=0%, 1=less than 5%, 2=5 to 9.9%, 3=10 to 14.9%, 4=15 to 19.9%, 5=20 to 24.9%, 6=25% or more)
    "bin_pov", -- Bin used for mapping percent of households in rural areas below poverty  (998=no rural population, 999=no population data, 0=0%, 1=less than 5%, 2=5 to 9.9%, 3=10 to 14.9%, 4=15 to 19.9%, 5=20 to 24.9%, 6=25% or more)
    "bin_p65", -- Bin for mapping percent of population in rural areas that is 65 and older (998=no rural population, 999=no population data, 0=0%, 1=less than 5%, 2=5 to 9.9%, 3=10 to 14.9%, 4=15 to 19.9%, 5=20 to 24.9%, 6=25% or more)
    "uemp", -- Percent of civilian labor force in rural areas unemployed
    "l10k", -- Percent of households in rural areas with income less than 10,000
    "pov", -- Percent of households in rural areas below poverty
    "p65", -- Percent of population in rural areas 65 or older
    "uemprail", -- Percent unemployed (civilian labor force) in rural areas with access to intercity rail transportation
    "l10krail", -- Percent of households in rural areas with access to intercity rail transportation and income less than 10,000 (2018 inflation adjusted dollars)
    "pov_rail", -- Percent of households below poverty in rural areas with access to intercity rail transportation
    "p65_rail", -- Percent 65 and older in rural areas with access to intercity rail transportation
    "uemp_bus", -- Percent unemployed (civilian labor force) in rural areas with access to intercity bus transportation
    "l10k_bus", -- Percent of households in rural areas with access to intercity bus transportation and income less than 10,000 (2018 inflation adjusted dollars)
    "pov_bus", -- Percent of households below poverty in rural areas with access to intercity bus transportation
    "p65_bus", -- Percent 65 and older in rural areas with access to intercity bus transportation
    "uempairl", -- Percent unemployed (civilian labor force) in rural areas with access to medium or large hub airport
    "l10kairl", -- Percent of households in rural areas with access to medium or large hub airport and income less than 10,000 (2018 inflation adjusted dollars)
    "pov_airl", -- Percent of households below poverty in rural areas with access to medium or large hub airport
    "p65_airl", -- Percent 65 and older in rural areas with access to medium or large hub airport
    "uemp_air", -- Percent unemployed (civilian labor force) in rural areas with access to air service
    "l10k_air", -- Percent of households in rural areas with access to air service and income less than 10,000 (2018 inflation adjusted dollars)
    "pov_air", -- Percent of households below poverty in rural areas with access to air service
    "p65_air", -- Percent 65 and older in rural areas with access to air service
    "uemp_any", -- Percent unemployed (civilian labor force) in rural areas with access to intercity transportation
    "l10k_any", -- Percent of households in rural areas with access to intercity transportation and income less than 10,000 (2018 inflation adjusted dollars)
    "pov_any", -- Percent of households below poverty in rural areas with access to intercity transportation
    "lf", -- Count of persons in civilian labor force in rural areas
    "hh", -- Count of households in rural areas
    "poprail", -- Rural population within 25 miles of intercity rail facility.
    "popbus", -- Rural population within 25 miles of intercity bus stop.
    "popairl", -- Rural population within 75 miles of large or medium airport with scheduled service.
    "popair", -- Rural population within 75 miles of large or medium airport or 25 miles of all other airports with scheduled service.
    "all_18c", -- Change in number of non-hub and small airports within 25 miles, medium and large airports within 75 miles, and intercity bus stops and intercity rail facilities within 25 miles of rural area between 2006 and 2021: -3: loss of 3 or more; -2: loss of 2; -1: loss of 1; 0: no change; 1: gain of 1; 2: gain of 2; 3: gain of 3 or more; 999: NA
    "rail_18c", -- Change in number of intercity rail facilities within 25 miles of rural area between 2006 and 2021: -3: loss of 3 or more; -2: loss of 2; -1: loss of 1; 0: no change; 1: gain of 1; 2: gain of 2; 3: gain of 3 or more; 999: NA
    "bus_18c", -- Change in number of intercity bus stops within 25 miles of rural area between 2006 and 2021: -3: loss of 3 or more; -2: loss of 2; -1: loss of 1; 0: no change; 1: gain of 1; 2: gain of 2; 3: gain of 3 or more; 999: NA
    "airl_18c", -- Change in number of medium and large airports within 75 miles of rural area between 2006 and 2021: -3: loss of 3 or more; -2: loss of 2; -1: loss of 1; 0: no change; 1: gain of 1; 2: gain of 2; 3: gain of 3 or more; 999: NA
    "air_18c", -- Change in number of non-hub and small airports within 25 miles and medium and large airports within 75 miles of rural area between 2006 and 2021: -3: loss of 3 or more; -2: loss of 2; -1: loss of 1; 0: no change; 1: gain of 1; 2: gain of 2; 3: gain of 3 or more; 999: NA
    "all_12c", -- Change in number of non-hub and small airports within 25 miles, medium and large airports within 75 miles, and intercity bus stops and intercity rail facilities within 25 miles of rural area in year and closest year 12 years prior: -3: loss of 3 or more; -2: loss of 2; -1: loss of 1; 0: no change; 1: gain of 1; 2: gain of 2; 3: gain of 3 or more; 999: NA
    "air_12c", -- Change in number of non-hub and small airports within 25 miles and medium and large airports within 75 miles of rural area in year and closest year 12 years prior: -3: loss of 3 or more; -2: loss of 2; -1: loss of 1; 0: no change; 1: gain of 1; 2: gain of 2; 3: gain of 3 or more; 999: NA
    "rail_6c", -- Change in number of intercity rail facilities within 25 miles of rural area in year and closest year 6 years prior: -3: loss of 3 or more; -2: loss of 2; -1: loss of 1; 0: no change; 1: gain of 1; 2: gain of 2; 3: gain of 3 or more; 999: NA
    "bus_6c", -- Change in number of intercity bus stops within 25 miles of rural area in year and closest year 6 years prior: -3: loss of 3 or more; -2: loss of 2; -1: loss of 1; 0: no change; 1: gain of 1; 2: gain of 2; 3: gain of 3 or more; 999: NA
    "abinall", -- Bin used to map PAccessAll: 999=population data NA; 998: no rural population; 0: no access; 1: <25 percent; 2: 25<=percent access<50; 3: 50<=percent access<75; 4: 75<=percent access<99; 5: percent access=100
    "abinrail", -- Bin used to map PAccessRail: 999=population data NA; 998: no rural population; 0: no access; 1: <25 percent; 2: 25<=percent access<50; 3: 50<=percent access<75; 4: 75<=percent access<99; 5: percent access=100
    "abinair", -- Bin used to map PAccessAir: 999=population data NA; 998: no rural population; 0: no access; 1: <25 percent; 2: 25<=percent access<50; 3: 50<=percent access<75; 4: 75<=percent access<99; 5: percent access=100
    "cntall", -- Number of non-hub and small airports within 25 miles of rural area and medium and large airports within 75 miles of rural area and intercity bus and intercity rail stops within 25 miles of rural area (includes airports, intercity bus stops, and intercity rail facilities outside of county)
    "cntbus", -- Number of intercity bus stops within 25 miles of rural area (includes stops outside of county)
    "cntairl", -- Number of medium and large airports within 75 miles of rural area (includes airports outside of county)
    "cntair", -- Number of non-hub and small airports within 25 miles of rural area and medium and large airports within 75 miles of rural area (includes airports outside of county)
    "paccall", -- Percent of rural population within 25 miles of non-hub or small airport, 75 miles of a medium or large airport, or 25 miles of intercity bus stop or intercity rail station
    "paccrail", -- Percent of rural population within 25 miles of intercity rail station
    "paccbus", -- Percent of rural population within 25 miles of intercity bus stop
    "paccairl", -- Percent of rural population within 75 miles of a medium or large airport
    "paccair", -- Percent of rural population within 25 miles of non-hub or small airport or 75 miles of a medium or large airport
    "y", -- Centroid of county, latitude
    "x", -- Centriod of county, longitude
    "statepo", -- State abbreviation
    "popbase", -- Dataset for population data
    "totpop", -- Total population
    "ruralpop", -- Total population living in rural block groups
    "totbg", -- Total number of block groups
    "cbsafp", -- Core based statistical area identifier if county lies within single CBSA
    "awater", -- Water area square meters
    "aland", -- Land area square meters
    "name", -- County name
    "geoid", -- State + county identifier
    "countyfp", -- County identifier
    "statefp", -- State identifier
    "povraict", -- Rural households below poverty and access to intercity rail transportation
    "l10busct", -- Rural households with income less than $10,000 and access to intercity bus transportation
    "popall", -- Rural population within 75 miles of large or medium airport or 25 miles from another airport with scheduled service or 25 miles of intercity bus stop or rail facility.
    "rail_12c", -- Change in number of intercity rail facilities within 25 miles of rural area in year and closest year 12 years prior: -3: loss of 3 or more; -2: loss of 2; -1: loss of 1; 0: no change; 1: gain of 1; 2: gain of 2; 3: gain of 3 or more; 999: NA
    "bus_12c", -- Change in number of intercity bus stops within 25 miles of rural area in year and closest year 12 years prior: -3: loss of 3 or more; -2: loss of 2; -1: loss of 1; 0: no change; 1: gain of 1; 2: gain of 2; 3: gain of 3 or more; 999: NA
    "airl_12c", -- Change in number of medium and large airports within 75 miles of rural area in year and closest year 12 years prior: -3: loss of 3 or more; -2: loss of 2; -1: loss of 1; 0: no change; 1: gain of 1; 2: gain of 2; 3: gain of 3 or more; 999: NA
    "all_6c", -- Change in number of non-hub and small airports within 25 miles, medium and large airports within 75 miles, and intercity bus stops and intercity rail facilities within 25 miles of rural area in year and closest year 6 years prior: -3: loss of 3 or more; -2: loss of 2; -1: loss of 1; 0: no change; 1: gain of 1; 2: gain of 2; 3: gain of 3 or more; 999: NA
    "airl_6c", -- Change in number of medium and large airports within 75 miles of rural area in year and closest year 6 years prior: -3: loss of 3 or more; -2: loss of 2; -1: loss of 1; 0: no change; 1: gain of 1; 2: gain of 2; 3: gain of 3 or more; 999: NA
    "air_6c", -- Change in number of non-hub and small airports within 25 miles and medium and large airports within 75 miles of rural area in year and closest year 6 years prior: loss of 3 or more; -2: loss of 2; -1: loss of 1; 0: no change; 1: gain of 1; 2: gain of 2; 3: gain of 3 or more; 999: NA
    "abinbus", -- Bin used to map PAccessBus: 999=population data NA; 998: no rural population; 0: no access; 1: <25 percent; 2: 25<=percent access<50; 3: 50<=percent access<75; 4: 75<=percent access<99; 5: percent access=100
    "abinairl", -- Bin used to map PAccessAirLarge: 999=population data NA; 998: no rural population; 0: no access; 1: <25 percent; 2: 25<=percent access<50; 3: 50<=percent access<75; 4: 75<=percent access<99; 5: percent access=100
    "cntrail", -- Number of intercity rail facilities within 25 miles of rural area (includes facilities outside of county)
    "year", -- Year of data
    "ruralbg", -- Number of rural block groups
    "the_geom" -- shape
FROM
    "bts-gov/access-to-intercity-air-bus-and-rail-m2bh-93w3:latest"."access_to_intercity_air_bus_and_rail"
LIMIT 100;

Connecting to the DDN is easy. All you need is an existing SQL client that can connect to Postgres. As long as you have a SQL client ready, you'll be able to query bts-gov/access-to-intercity-air-bus-and-rail-m2bh-93w3 with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at data.bts.gov. When you querybts-gov/access-to-intercity-air-bus-and-rail-m2bh-93w3:latest on the DDN, we "mount" the repository using the socrata mount handler. The mount handler proxies your SQL query to the upstream data source, translating it from SQL to the relevant language (in this case SoQL).

We also cache query responses on the DDN, but we run the DDN on multiple nodes so a CACHE_HIT is only guaranteed for subsequent queries that land on the same node.

Query Your Local Engine

Install Splitgraph Locally
bash -c "$(curl -sL https://github.com/splitgraph/splitgraph/releases/latest/download/install.sh)"
 

Read the installation docs.

Splitgraph Cloud is built around Splitgraph Core (GitHub), which includes a local Splitgraph Engine packaged as a Docker image. Splitgraph Cloud is basically a scaled-up version of that local Engine. When you query the Data Delivery Network or the REST API, we mount the relevant datasets in an Engine on our servers and execute your query on it.

It's possible to run this engine locally. You'll need a Mac, Windows or Linux system to install sgr, and a Docker installation to run the engine. You don't need to know how to actually use Docker; sgrcan manage the image, container and volume for you.

There are a few ways to ingest data into the local engine.

For external repositories (like this repository), the Splitgraph Engine can "mount" upstream data sources by using sgr mount. This feature is built around Postgres Foreign Data Wrappers (FDW). You can write custom "mount handlers" for any upstream data source. For an example, we blogged about making a custom mount handler for HackerNews stories.

For hosted datasets, where the author has pushed Splitgraph Images to the repository, you can "clone" and/or "checkout" the data using sgr cloneand sgr checkout.

Mounting Data

This repository is an external repository. It's not hosted by Splitgraph. It is hosted by data.bts.gov, and Splitgraph indexes it. This means it is not an actual Splitgraph image, so you cannot use sgr clone to get the data. Instead, you can use the socrata adapter with the sgr mount command. Then, if you want, you can import the data and turn it into a Splitgraph image that others can clone.

First, install Splitgraph if you haven't already.

Mount the table with sgr mount

sgr mount socrata \
  "bts-gov/access-to-intercity-air-bus-and-rail-m2bh-93w3" \
  --handler-options '{
    "domain": "data.bts.gov",
    "tables": {
        "access_to_intercity_air_bus_and_rail": "m2bh-93w3"
    }
}'

That's it! Now you can query the data in the mounted table like any other Postgres table.

Query the data with your existing tools

Once you've loaded the data into your local Splitgraph engine, you can query it with any of your existing tools. As far as they're concerned, bts-gov/access-to-intercity-air-bus-and-rail-m2bh-93w3 is just another Postgres schema.