Fetch Module#
The Fetch module provides functions for retrieving GEOIDs based on various criteria, including spatial filters, state boundaries, and predefined regions.
Spatial Filtering#
Functions for retrieving GEOIDs based on spatial criteria:
GeoIDs.Fetch.get_geoids_by_spatial_filter
source
get_geoids_by_spatial_filter(filter_type::Symbol, parameters::Dict) -> Vector{String}
Generate GEOIDs based on spatial filtering parameters.
Filter Types
:longitude: Filter by longitude range (requiresmin_lon,max_lon):latitude: Filter by latitude range (requiresmin_lat,max_lat):bounding_box: Filter by bounding box (requiresmin_lon,max_lon,min_lat,max_lat):distance: Filter by distance from point (requirescenter_lon,center_lat,radius_miles):state: Filter by state (requiresstatesas array of state abbreviations):intersects: Filter by intersection with geometry (requiresgeometry)
Example
# Get counties within longitude range
west_counties = get_geoids_by_spatial_filter(:longitude, Dict("min_lon" => -120.0, "max_lon" => -110.0))
# Get counties within 50 miles of Chicago
chicago_area = get_geoids_by_spatial_filter(:distance, Dict(
"center_lon" => -87.623177,
"center_lat" => 41.881832,
"radius_miles" => 50
))
Regional and State Filters#
Functions for retrieving GEOIDs based on predefined regions or state boundaries:
GeoIDs.Fetch.get_geoids_by_state
source
get_geoids_by_state(state::String) -> Vector{String}
Get GEOIDs for all counties in a state.
Arguments
state::String: State postal code (e.g., "CA")
Returns
Vector{String}: GEOIDs for counties in the state
Example
ca_geoids = get_geoids_by_state("CA")
GeoIDs.Fetch.get_western_geoids
source
get_western_geoids() -> Vector{String}
Returns GEOIDs for counties west of 100°W longitude and east of 115°W longitude, getting the high plains counties with historically low rainfall (< 20 inches per year).
GeoIDs.Fetch.get_eastern_geoids
source
get_eastern_geoids() -> Vector{String}
Returns GEOIDs for counties between 90°W and 100°W longitude, getting the eastern counties with historically high rainfall (> 20 inches per year).
GeoIDs.Fetch.get_florida_south_geoids
source
get_florida_south_geoids() -> Vector{String}
Returns GEOIDs for Florida counties with centroids south of 29°N latitude.
County Retrieval#
GeoIDs.Fetch.get_geoids_by_states
source
get_geoids_by_states(states::Vector{String}) -> Vector{String}
Get GEOIDs for all counties in multiple states.
Arguments
states::Vector{String}: Vector of state postal codes (e.g., ["CA", "OR", "WA"])
Returns
Vector{String}: GEOIDs for counties in the specified states
Example
west_coast_geoids = get_geoids_by_states(["CA", "OR", "WA"])
GeoIDs.Fetch.get_geoids_by_county_names
source
get_geoids_by_county_names(state::String, counties::Vector{String}) -> Vector{String}
Get GEOIDs for specific counties in a state by name.
Arguments
state::String: State postal code (e.g., "CA")counties::Vector{String}: Vector of county names
Returns
Vector{String}: GEOIDs for the specified counties
Example
socal_geoids = get_geoids_by_county_names("CA", ["Los Angeles", "Orange", "San Diego"])
GeoIDs.Fetch.get_geoids_by_population_range
source
get_geoids_by_population_range(min_pop::Int, max_pop::Int) -> Vector{String}
Get GEOIDs for counties with population within the specified range.
Arguments
min_pop::Int: Minimum populationmax_pop::Int: Maximum population
Returns
Vector{String}: GEOIDs for counties in the population range
Example
rural_counties = get_geoids_by_population_range(0, 50000)
GeoIDs.Fetch.get_geoids_by_custom_query
source
get_geoids_by_custom_query(query::String, params::Vector=[]) -> Vector{String}
Get GEOIDs using a custom SQL query.
Arguments
query::String: Custom SQL query (must return a 'geoid' column)params::Vector: Query parameters
Returns
Vector{String}: GEOIDs returned by the query
Example
custom_geoids = get_geoids_by_custom_query(
"SELECT geoid FROM census.counties WHERE name LIKE $1",
["%San%"]
)
Module Index#
GeoIDs.Fetch.get_eastern_geoidsGeoIDs.Fetch.get_florida_south_geoidsGeoIDs.Fetch.get_geoids_by_county_namesGeoIDs.Fetch.get_geoids_by_custom_queryGeoIDs.Fetch.get_geoids_by_population_rangeGeoIDs.Fetch.get_geoids_by_spatial_filterGeoIDs.Fetch.get_geoids_by_stateGeoIDs.Fetch.get_geoids_by_statesGeoIDs.Fetch.get_western_geoids