Skip to content

Burnt-area perimeters

effis_client.perimeters

Burnt-area perimeters from the EFFIS WFS.

The endpoint is MapServer, not GeoServer, and that shapes every choice below. Verified against the live service:

  • the base path is /gwis, not /gwis/ows -- the latter hangs;
  • the layer is nrt.ba.poly. A layer that does not exist makes MapServer close the connection mid-response, which surfaces as a transport error rather than a 404;
  • CQL_FILTER is a GeoServer vendor parameter. MapServer ignores it, so a date range expressed that way silently filters nothing;
  • bbox and filter are mutually exclusive in WFS (and combining them kills the connection), so the bbox goes on the wire and the dates are applied locally. Cheap in practice: one Italian region's whole history is a single response -- Basilicata is 515 perimeters across 2012-2026, 305 KB;
  • parameter names are lowercase: MapServer's WFS 1.1.0 does not accept the camelCase spellings GeoServer tolerates.

No credentials are needed.

Perimeters dataclass

The perimeters in the requested window, and how many came back in all.

truncated is true when the server returned exactly its cap: the local date filter then worked on a partial set, and a gap would read as "no fires that season". Raise max_features or shrink the bbox.

perimeters_params

perimeters_params(bbox: BBox, *, layer: str = LAYER, max_features: int = DEFAULT_MAX_FEATURES) -> dict[str, str]

Query parameters of the WFS GetFeature request for bbox.

feature_date

feature_date(feature: dict[str, Any]) -> date | None

The day a fire started, from whichever field the layer carries.

parse_perimeters

parse_perimeters(content: bytes | str, *, start: date, end: date, max_features: int = DEFAULT_MAX_FEATURES) -> Perimeters

Parse a GetFeature response and keep the fires started in [start, end].

A feature with no readable date is kept: dropping it would lose a perimeter that is still real. An empty body is an empty result.

Raises :class:EffisError when the body is not a GeoJSON FeatureCollection -- MapServer answers 200 with an XML exception report.

fetch_perimeters async

fetch_perimeters(client: AsyncClient, bbox: BBox, *, start: date, end: date, url: str = WFS_URL, layer: str = LAYER, max_features: int = DEFAULT_MAX_FEATURES) -> Perimeters

Fetch the burnt-area perimeters intersecting bbox, started in [start, end].

Network and HTTP errors propagate (httpx.HTTPError); retries and timeouts are the caller's, through client.