The US Distance to Coast API by GeoRiskServices.com allows you to calculate the distance of a given location to the nearest U.S. coastline. Whether you are using geographic coordinates (latitude and longitude) or a physical address, this API provides flexibility and precision. Here’s how to use it effectively.


The API can be accessed via the following endpoint:

https://www.allthingsdev.co/apimarketplace/endpoints/geo-risk-services/67b9249d563cbd684a8bf1fc

The API accepts one of the following sets of input:

  1. Latitude and Longitude:
    • lat: Latitude (number, between -90 and 90).
    • lon: Longitude (number, between -180 and 180).
  2. Address:
    • address: A string representing a physical address (e.g., “123 Main St, Anytown, USA”).
  • perf: Boolean – Enables performance-related metrics. Default: false.
  • lines: Boolean – Includes detailed line information in the response. Default: false.
  • anno: Boolean – Includes annotations in the response. Default: true.
{
    "lat": 40.712776,
    "lon": -74.005974,
    "dist_m": 30000,
    "perf" : true,
    "geom" : false,
    "anno" : true,
    "return_elevation": true,
    "out_units": "meters"
}

Or using an address:

{
    "address": "232 Orozco Ct, Parlier, CA 93648",
    "dist_m": 30000,
    "perf" : true,
    "geom" : false,
    "anno" : true,
    "return_elevation": true,
    "out_units": "meters"
}

Choose the input method:

  • Use lat and lon for geographic coordinates.
  • Use address for a physical address.

Send a POST request to the API endpoint with the JSON payload.

Using Latitude and Longitude:

curl --location 'https://Geo-Risk-Services.proxy-production.allthingsdev.co/usdistance2flood' \
--header 'Content-Type: application/json' \
--header 'x-apihub-key: fj1jXaBtgygVVeOXYx6F1mNcd70F00XmnLnbEvGnNr831j-t5f' \
--header 'x-apihub-host: Geo-Risk-Services.allthingsdev.co' \
--header 'x-apihub-endpoint: 0d0e7a8c-5879-4442-99bf-35153b4798b1' \
--header 'Content-Type: application/json' \
--data '{   
"lat":43.724452139596025,
"lon":-111.11266618035073,
"dist_m":10000,
"perf":true,
"geom":false,
"anno":true,
"return_elevation":true,
"out_units":"meters"
}'

Using an Address:

curl --location 'https://Geo-Risk-Services.proxy-production.allthingsdev.co/usdistance2flood' \
--header 'Content-Type: application/json' \
--header 'x-apihub-key: fj1jXaBtgygVVeOXYx6F1mNcd70F00XmnLnbEvGnNr831j-t5f' \
--header 'x-apihub-host: Geo-Risk-Services.allthingsdev.co' \
--header 'x-apihub-endpoint: 0d0e7a8c-5879-4442-99bf-35153b4798b1' \
--header 'Content-Type: application/json' \
--data '{
    "address": "232 Orozco Ct, Parlier, CA 93648",
    "dist_m": 30000,
    "perf" : true,
    "geom" : false,
    "anno" : true,
    "return_elevation": true,
    "out_units": "meters"
}'

The API responds with a JSON object containing details about the distance to the nearest flood-prone area.

Example response:

{
    "status": "success",
    "api_perf_ms": 2126,
    "error": "",
    "input_params": {
        "lat": 36.612953800612,
        "lon": -119.519714228876,
        "address": "232 Orozco Ct, Parlier, CA 93648",
        "perf": true,
        "geom": false,
        "anno": true,
        "dist_m": 30000,
        "return_elevation": true
    },
    "results": {
        "addr_elev_ft": 342.60172701312365,
        "feature_elev_ft": 343.18597144783,
        "slope": -0.0014612163552176715,
        "num_features": 1,
        "distance_m": 399.83431106568116,
        "geom": {}
    },
    "annotations": {
        "annotations": [
            {
                "org": "US Census",
                "org_link": "https://www.census.gov/",
                "data_service": "https://geocoding.geo.census.gov/geocoder/",
                "grs_last_udpate": "2024-08-17T22:22:32.631807+00:00"
            },
            {
                "org": "US FEMA",
                "org_link": "https://www.fema.gov/",
                "data_service": "https://hazards.fema.gov/arcgis/rest/services/public/NFHL/MapServer/28/query",
                "grs_last_udpate": null
            },
            {
                "org": "USGS",
                "org_link": "https://www.usgs.gov",
                "data_service": "https://apps.nationalmap.gov/epqs/",
                "grs_last_udpate": "2024-09-01T01:25:43.77738+00:00"
            }
        ]
    }
}
  • distance_to_flood: Distance from the location to the nearest flood-prone area.
  • units: The unit of measurement for the distance (e.g., miles, kilometers).
  • annotations: Additional details, such as the name or description of the nearest flood area.

  1. Real Estate: Assess flood risks for properties.
  2. Insurance: Calculate proximity to flood zones for underwriting purposes.
  3. Emergency Planning: Identify high-risk areas for disaster preparedness.

  • Use geographic coordinates (lat, lon) for the most precise results.
  • Enable perf only if you require performance-related data.
  • Experiment with lines and anno parameters to customize the response to your needs.

The US Distance to Flood API is an invaluable resource for anyone needing fast, reliable geospatial risk analysis. With simple inputs and detailed outputs, it’s easy to integrate into your applications or workflows.