bayareametro-gov/national-flood-hazard-layer-hess-nw9p-ap8v
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 national_flood_hazard_layer_hess table in this repository, by referencing it like:

"bayareametro-gov/national-flood-hazard-layer-hess-nw9p-ap8v:latest"."national_flood_hazard_layer_hess"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "zone_subty", -- Flood Zone Subtype. This field captures additional information about the flood zones not related to insurance rating purposes. For example, Zone X could have “AREA WITH REDUCED FLOOD RISK DUE TO LEVEE” or “0.2 PCT ANNUAL CHANCE FLOOD HAZARD” as a subtype. Types of floodways are also stored in this field. Floodways are designated by FEMA and adopted by communities to provide an area that will remain free of development to moderate increases in flood heights due to encroachment on the floodplain. Normal floodways are specified as ‘FLOODWAY.’ Special cases will have a more specific term for the designation (such as COLORADO RIVER) and will appear as a note on the hardcopy FIRM. See the FIRM Panel Technical Reference for available floodway notes. NOTE: The symbol ‘%’ is a reserved symbol in most software packages, so the word ‘percent’ was abbreviated to ‘PCT’. Column values are 0.2 PCT ANNUAL CHANCE FLOOD HAZARD (500-year flood zone), 0.2 PCT ANNUAL CHANCE FLOOD HAZARD CONTAINED IN CHANNEL (500-year flood zone in channel), 1 PCT ANNUAL CHANCE FLOOD HAZARD CONTAINED IN CHANNEL (100-year flood zone in channel), 1 PCT ANNUAL CHANCE FLOOD HAZARD CONTAINED IN STRUCTURE (100-year flood zone in structure), 1 PCT DEPTH LESS THAN 1 FOOT (Shaded Zone X: 1% annual chance flood hazards with average depths of less than 1 foot. This zone is classified as being within the 500 year floodplain and not the 100 year floodplain because of the following: Flood zones AH and AO reference a base flood depth between 1 and 3 feet. This is in place of a Base Flood Elevation. An area that has a base flood depth below 1 foot is considered to be flood zone X, since the area affected by the 100 year flooding event would be too shallow or too small to identify on the Flood Insurance Rate Map. Please refer to the Shallow Flooding Analyses and Mapping technical document at https://www.fema.gov/media-library-data/1484865782763-4d150592d6eae9fdb5e2c2ab597928a6/Shallow_Flooding_Guidance_Nov_2016.pdf for more information on this classification), AREA OF MINIMAL FLOOD HAZARD (Unshaded Zone X: Areas of minimal flood hazard), AREA WITH REDUCED FLOOD RISK DUE TO LEVEE (Area with Reduced Flood Risk due to Levee: Areas where an accredited levee, dike, or other flood control structure has reduced the flood risk from the 1% annual chance flood (100-year flood zone)), FLOODWAY (A "Regulatory Floodway" means the channel of a river or other watercourse and the adjacent land areas that must be reserved in order to discharge the base flood without cumulatively increasing the water surface elevation more than a designated height. Communities must regulate development in these floodways to ensure that there are no increases in upstream flood elevations. For streams and other watercourses where FEMA has provided Base Flood Elevations (BFEs), but no floodway has been designated, the community must review floodplain development on a case-by-case basis to ensure that increases in water surface elevations do not occur, or identify the need to adopt a floodway if adequate information is available), and FLOODWAY CONTAINED IN CHANNEL (An area where the floodway is contained within the channel banks and the channel is too narrow to show to scale. An arbitrary channel width of  3 meters is shown. BFEs are not shown in this area, although they may be reflected on the corresponding profile).
    "version_id", -- Version Identifier. Identifies the product version and relates the feature to standards according to how it was created.
    "velocity", -- This is the velocity measurement of the flood flow in the area. Normally this is applicable to alluvial fan areas (certain Zone AO areas). This value is shown beneath the zone label on the FIRM. This field is only populated when a velocity is associated with the flood zone area.
    "vel_unit", -- Velocity Unit. This is the unit of measurement for the velocity. This field is populated when the VELOCITY field is populated. *There are no values in this field*
    "v_datum", -- Vertical Datum. The vertical datum indicates the reference surface from which the flood elevations are measured. Normally this would be North American Vertical Datum of 1988 for new studies. This field is only populated if the STATIC_BFE field is populated.
    "study_typ", -- Study Type. This describes the type of Flood Risk Project performed for flood hazard identification. Column values are DIGITAL CONVERSION (Mapping products created by converting non-revised effective FIRM information to digital format), NP (Not populated), REDELINEATION (Mapping products created by redelineating floodplains using updated topographic data), SFHAs WITH HIGH FLOOD RISK (Shaded X - an area of moderate flood hazard that is determined to be outside the Special Flood Hazard Area between the limits of the base flood and the 0.2-percent-annual-chance (or 500-year) flood), and SFHAs WITH LOW FLOOD RISK (Unshaded X - an area of minimal flood hazard that is determined to be outside the Special Flood Hazard Area and higher than the elevation of the 0.2-percent-annual-chance (or 500-year) flood).
    "static_bfe", -- Static Base Flood Elevation. This field will be populated for areas that have been determined to have a constant Base Flood Elevation (BFE) over a flood zone. The BFE value will be shown beneath the zone label. In this situation the same BFE applies to the entire polygon. This normally occurs in lakes or coastal zones.
    "st_perimet", -- Feature perimeter length in meters.
    "st_area_sh", -- Feature area in square meters.
    "source_cit", -- Source Citation. Abbreviation used in the metadata file when describing the source information for the feature.
    "shape_length", -- Feature perimeter length in decimal degrees.
    "shape_area", -- Feature perimeter length in square decimal degrees.
    "len_unit", -- Length Units. This unit indicates the measurement system used for the BFEs and/or depths. Normally this would be feet. This field is only populated if the STATIC_BFE or DEPTH field is populated. Column values are either Feet (Measurement system used for Base Flood Elevations and/or depths is feet (US Feet)) or <NULL> (No measurement system used because because there is no value in either STATIC_BFE or DEPTH fields).
    "fld_ar_id", -- Primary key for table lookup. Assigned by table creator.
    "dual_zone", -- Flood Control Restoration Zones – Dual Zone Classification. If the flood hazard areas shown on the effective FIRM shall be designated as “dual” flood insurance rate zones (i.e., Zone AR/AE, Zone AR/AH, Zone AR/AO, Zone AR/A), this field will be coded as true. It should be false for any for AR Zones that revert to Shaded X. *There are no values in this field*
    "dfirm_id", -- Study Identifier. This is the Digital Flood Insurance Rate Map (DFIRM) identification value for the countywide Flood Risk Project, the values for this column are composed of the two-digit State Federal Information Processing Series (FIPS) code, the three-digit county FIPS code and the letter “C” (e.g., 48107C). Within each Flood Insurance Rate Map Database, the DFIRM_ID value will be identical.
    "depth", -- This is the depth for Zone AO areas. This value is shown beneath the zone label on the FIRM. This field is only populated if a depth is shown on the FIRM.
    "bfe_revert", -- Flood Control Restoration Zones – BFE Revert. If zone is Zone AR in FLD_Zone field, this field would hold the static base flood elevation for the reverted zone. This field is populated when Zone equals AR and the reverted zone has a static BFE.
    "ar_subtrv", -- Flood Control Restoration Zones – Zone AR Classification Zone Subtype. If this area is Zone AR in FLD_Zone field, this field would hold the zone subtype that area would revert to if the AR zone were removed. This field is only populated if the corresponding area is Zone AR. NOTE: The symbol ‘%’ is a reserved symbol in most software packages, so the word ‘percent’ was abbreviated to ‘PCT.’ Acceptable values for this field must be one of the allowable subtypes for Zones AE, AO, AH, A or X. *There are no values in this field*
    "ar_revert", -- Flood Control Restoration Zones – Zone AR Classification. If this area is Zone AR in FLD_Zone field, this field would hold the zone that area would revert to if the AR zone were removed. This field is only populated if the corresponding area is Zone AR. Acceptable values for this field are listed in the D_Zone table, but should only include one of AE, AO, AH, A, and X domain values. *There are no values in this field*
    "fld_zone", -- Flood Zone. This is a flood zone designation. These zones are used by FEMA to designate the SFHAs and for insurance rating purposes. Column values are A (Areas subject to inundation by the 1-percent-annual-chance flood event generally determined using approximate methodologies. Because detailed hydraulic analyses have not been performed, no Base Flood Elevations (BFEs) or flood depths are shown. Mandatory flood insurance purchase requirements and floodplain management standards apply), A99 (Areas subject to inundation by the 1-percent-annual-chance flood event, but which will ultimately be protected upon completion of an under-construction Federal flood protection system. These are areas of special flood hazard where enough progress has been made on the construction of a protection system, such as dikes, dams, and levees, to consider it complete for insurance rating purposes. Zone A99 may only be used when the flood protection system has reached specified statutory progress toward completion. No Base Flood Elevations (BFEs) or depths are shown. Mandatory flood insurance purchase requirements and floodplain management standards apply), AE (Areas subject to inundation by the 1-percent-annual-chance flood event determined by detailed methods. Base Flood Elevations (BFEs) are shown. Mandatory flood insurance purchase requirements and floodplain management standards apply), AH (Areas subject to inundation by 1-percent-annual-chance shallow flooding (usually areas of ponding) where average depths are between one and three feet. Base Flood Elevations (BFEs) derived from detailed hydraulic analyses are shown in this zone. Mandatory flood insurance purchase requirements and floodplain management standards apply), AO (Areas subject to inundation by 1-percent-annual-chance shallow flooding (usually sheet flow on sloping terrain) where average depths are between one and three feet. Average flood depths derived from detailed hydraulic analyses are shown in this zone. Mandatory flood insurance purchase requirements and floodplain management standards apply.  Some Zone AO have been designated in areas with high flood velocities such as alluvial fans and washes. Communities are encouraged to adopt more restrictive rquirements for these areas), AREA NOT INCLUDED (An area that is located within a community or county that is not mapped on any published FIRM), D (The Zone D  designation is used for areas where there are possible but undetermined flood hazards, as no analysis of flood hazards has been  conducted. The designation of Zone D is also used when a community incorporates portions of another community’s area  where no map has been prepared), OPEN WATER (Open water), V (Areas along coasts subject to inundation by the 1-percent-annual-chance flood event with additional hazards associated with storm-induced waves. Because detailed hydraulic analyses have not been performed, no Base Flood Elevations (BFEs) or flood depths are shown. Mandatory flood insurance purchase requirements and floodplain management standards apply), VE (Areas subject to inundation by the 1-percent-annual-chance flood event with additional hazards due to storm-induced velocity wave action. Base Flood Elevations (BFEs) derived from detailed hydraulic analyses are shown. Mandatory flood insurance purchase requirements and floodplain management standards apply), and X (Zone X is classified as Shaded or Unshaded. (1) Shaded Zone X: Areas of 0.2% annual chance flood hazards and areas of 1% annual chance flood hazards with average depths of less than 1 foot or with drainage areas less than 1 square mile. (2) Future Conditions: 1% Annual Chance Flood Hazard - Zone X: The flood insurance rate zone that corresponds to the 1% annual chance floodplains that are determined based on future-conditions hydrology. No base flood elevations or flood depths are shown within this zone. (3) Area with Reduced Flood Risk due to Levee: Areas where an accredited levee, dike, or other flood control structure has reduced the flood risk from the 1% annual chance flood. See Notes to Users for important information. (4) Area with Flood Risk due to Levee: Areas where a non-accredited levee, dike, or other flood control structure is shown as providing protection to less than the 1% annual chance flood. (5) Unshaded Zone X: Areas of minimal flood hazard).
    "dep_revert", -- Flood Control Restoration Zones – Depth Revert. If zone is Zone AR in FLD_Zone field, this field would hold the flood depth for the reverted zone. This field is populated when Zone equals AR and the reverted zone has a depth assigned.
    "sfha_tf", -- Special Flood Hazard Area. If the area is within a SFHA this field would be true. This field will be true for any area coded as an A or V flood zone area. It should be false for any X or D flood areas. Column values are T (True/Yes - area is within a Special Flood Hazard Area) and F (False/No - area is not within a Special Flood Hazard Area).
    "geometry" -- Feature geometry. Coordinates defining the features.
FROM
    "bayareametro-gov/national-flood-hazard-layer-hess-nw9p-ap8v:latest"."national_flood_hazard_layer_hess"
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 bayareametro-gov/national-flood-hazard-layer-hess-nw9p-ap8v with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at data.bayareametro.gov. When you querybayareametro-gov/national-flood-hazard-layer-hess-nw9p-ap8v: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.bayareametro.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 \
  "bayareametro-gov/national-flood-hazard-layer-hess-nw9p-ap8v" \
  --handler-options '{
    "domain": "data.bayareametro.gov",
    "tables": {
        "national_flood_hazard_layer_hess": "nw9p-ap8v"
    }
}'

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, bayareametro-gov/national-flood-hazard-layer-hess-nw9p-ap8v is just another Postgres schema.