Client¶
The KyFromAboveClient class provides the same functionality as the
top-level functions but lets you manage STAC connections and configuration
explicitly.
from abovepy import KyFromAboveClient
client = KyFromAboveClient()
tiles = client.search(county="Pike", product="dem_phase3")
KyFromAboveClient
¶
Client for accessing KyFromAbove LiDAR, DEM, and orthoimagery.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cache_dir
|
str or Path
|
Local directory for caching downloaded tiles. |
None
|
stac_url
|
str
|
Override the STAC API endpoint URL. |
None
|
Examples:
>>> client = KyFromAboveClient()
>>> tiles = client.search(county="Franklin", product="dem_phase3")
>>> paths = client.download(tiles, output_dir="./data")
search(bbox=None, product='dem_phase3', county=None, crs=DEFAULT_INPUT_CRS, datetime=None, max_items=500, intersects=None, filter=None, sortby=None, ids=None, fields=None, point=None, buffer_miles=None, buffer_feet=None, geometry=None)
¶
Find tiles intersecting an area of interest.
Provide one of: bbox, county, point, geometry,
intersects, or ids.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bbox
|
tuple
|
Bounding box as (xmin, ymin, xmax, ymax). |
None
|
product
|
str
|
Product key (e.g., "dem_phase3"). |
'dem_phase3'
|
county
|
str
|
Kentucky county name. Overrides bbox if provided. |
None
|
crs
|
str
|
CRS of input bbox. Default "EPSG:4326". |
DEFAULT_INPUT_CRS
|
datetime
|
str
|
ISO 8601 datetime range. |
None
|
max_items
|
int
|
Maximum tiles to return. |
500
|
intersects
|
dict or Shapely geometry
|
GeoJSON geometry or Shapely geometry for spatial intersection. |
None
|
filter
|
dict or str
|
CQL2 filter expression for advanced STAC queries. |
None
|
sortby
|
list[str] or str
|
Sort fields (e.g., |
None
|
ids
|
list[str]
|
Specific STAC item IDs to fetch. |
None
|
fields
|
list[str]
|
Fields to include/exclude from the STAC response. |
None
|
point
|
tuple
|
(longitude, latitude) point. Used with |
None
|
buffer_miles
|
float
|
Buffer radius in miles around |
None
|
buffer_feet
|
float
|
Buffer radius in US survey feet around |
None
|
geometry
|
Shapely geometry
|
Any Shapely geometry for spatial search. |
None
|
Returns:
| Type | Description |
|---|---|
SearchResult
|
Tile index wrapped in a workflow object. |
download(tiles, output_dir, overwrite=False)
¶
Download tiles to a local directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tiles
|
GeoDataFrame
|
Tile index from search(). |
required |
output_dir
|
str or Path
|
Destination directory. |
required |
overwrite
|
bool
|
Overwrite existing files. Default False. |
False
|
Returns:
| Type | Description |
|---|---|
list[Path]
|
Paths to downloaded files. |
read(source, bbox=None, crs=None)
¶
Read a raster tile, optionally windowed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str or Path
|
Local path, S3 URI, or HTTPS URL. |
required |
bbox
|
tuple
|
Bounding box for windowed read. |
None
|
crs
|
str
|
CRS of the bbox. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[ndarray, dict]
|
(data, profile). |
mosaic(tiles_or_paths, bbox=None, output=None, crs=None)
¶
Mosaic tiles into a single raster or VRT.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tiles_or_paths
|
list[Path] or GeoDataFrame
|
Tile paths or tile index. |
required |
bbox
|
tuple
|
Clip to bounding box. |
None
|
output
|
str or Path
|
Output path. .vrt → VRT (default), .tif → GeoTIFF. |
None
|
crs
|
str
|
Reproject to this CRS. |
None
|
Returns:
| Type | Description |
|---|---|
Path or tuple[ndarray, dict]
|
|
info(source=None)
¶
Inspect products or a remote tile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
Product key, URL, or S3 URI. None → all products. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame or dict
|
|
get_stac_client()
¶
Get the underlying pystac-client Client for advanced queries.
Returns:
| Type | Description |
|---|---|
Client
|
|