Boundaries¶
Use the boundary= parameter to define your study area. geointerpo accepts five input formats and normalizes all of them to a single WGS-84 GeoDataFrame.
Input formats¶
Place name¶
Pass any city, region, or country name. geointerpo resolves it for free using OpenStreetMap's Nominatim geocoder — no API key required.
Pipeline(boundary="Calgary, Alberta, Canada", ...)
Pipeline(boundary="Tehran, Iran", ...)
Pipeline(boundary="Bavaria, Germany", ...)
For higher-quality polygon boundaries, install osmnx and set boundary_provider="osmnx":
Bounding box¶
Pass a four-value tuple (min_lon, min_lat, max_lon, max_lat):
File path¶
Pass a path to any vector file. Supported formats: .geojson, .gpkg, .shp, .zip.
GeoDataFrame or Shapely geometry¶
Pass an object you already have in memory:
No boundary¶
Omit boundary= entirely. The grid covers the extent of your point data plus padding_deg on each side.
What the boundary does¶
When you provide a boundary, geointerpo uses it for three things:
- Grid bbox — builds the interpolation grid from the boundary's bounding box, extended by
padding_deg(default0.5°) on each side. - Output clipping — after interpolation, sets grid cells outside the polygon to
NaN. Requires the[raster]extra. Disable withclip_to_boundary=False. - API scoping — when you use a live data source (
data="meteostat"etc.), the boundary bbox limits the station search area.
Pipeline(
boundary="Calgary, AB",
padding_deg=0.2, # tighter grid padding
clip_to_boundary=True, # mask outside cells (default)
)
Use boundaries directly¶
To work with boundaries outside the Pipeline:
from geointerpo.boundaries import load_boundary, boundary_bbox
boundary = load_boundary("Calgary, Alberta, Canada")
# Returns a single-row, dissolved, make_valid'd GeoDataFrame in EPSG:4326
bbox = boundary_bbox(boundary)
# Returns (min_lon, min_lat, max_lon, max_lat)
load_boundary always returns a normalised GeoDataFrame regardless of input format.
Troubleshooting¶
ValueError: Could not geocode location
Nominatim could not find the place name. Try one of the following:
- Use a more specific name:
"Calgary, Alberta, Canada"instead of"Calgary" - Pass a bbox tuple:
boundary=(-114.5, 50.8, -113.8, 51.3) - Pass a file path:
boundary="my_region.geojson"
Boundary clips everything to NaN
The boundary polygon does not overlap your station data. To diagnose:
- Run
boundary_bbox(boundary)and confirm the bbox covers your stations. - Check that
rioxarrayis installed:pip install "geointerpo[raster]" - Set
clip_to_boundary=Falseto rule out the clipping step.