Skip to content

v5.4.0

Choose a tag to compare

@mbewley mbewley released this 05 Nov 02:00
· 121 commits to main since this release
40c5dce

What's New

Large gridded AOIs no longer report roofs and buildings at several times their real area. Scores the API skips are now retried, and very large parcels gridded, instead of left null. Bad dates are now refused before an export starts. The repository also ships an Agent Skill, so Claude Code, Codex or Gemini CLI can answer questions about the APIs and nmaipy's outputs.

Bug Fixes

  • Roof and building areas on gridded AOIs are no longer multiplied by the number of grid cells.
    • Before: when an AOI was gridded (over about 1 sq km, or after a size error), area_* and <class>_total_area_* of discrete features (roofs, buildings, pools, …) were multiplied by the number of cells each feature touched.
    • Now: each object's whole area is kept once. Connected classes (vegetation, surfaces) still add up their in-cell pieces, and clipped_area_* and unclipped_area_* are unchanged.
    • Exports of gridded AOIs made with earlier versions will differ on area_* and <class>_total_area_*.
  • Scores the API skips are now retried, and very large parcels gridded, instead of coming back null.
    • Before: when the Feature API returned an include such as roofSpotlightIndex or hurricaneScore as {"skipped": true} (very large parcels, or under load), regrid_on_skip, on by default, never fired, so those score columns stayed null.
    • Now: nmaipy requests the AOI once more, unchanged, after 10 seconds, which clears a skip caused by load. If the score is still skipped and the AOI spans more than one small grid cell (0.002°, about 0.04 sq km, roughly 20 roofs even in dense urban areas), it is gridded at that size, so each cell is a request the scorer can handle. Otherwise, or if the retry fails or the grid fails or is incomplete, the AOI keeps its first response and the scores stay null as before. Each step is logged at INFO, and --no-retry-on-realtime-skip (retry_on_realtime_skip=False) turns off both.
    • The cells are pinned to the first response's survey and queried without parcelMode, so a regridded AOI is reported like any gridded AOI: features crossing its boundary, neighbours' roofs included, are kept, and belongs_to_parcel is null. Its parcel-level aggregate comes from the first response.
  • Roof Age requests now honour --max-retries. Before, the Roof Age client always used the default retry budget, whatever the exporter was given.
  • Roof component columns no longer carry score-model descriptions in the export README. Before, score models' input fields with the same bare names overrode them: flat_present was described as asphalt shingles, and tree_overhang_ratio and metal_present as score-model inputs. The belongs_to_parcel description is also corrected.
  • Help text:
    • --until no longer calls itself the earliest date;
    • --roof-age-dataset no longer says latest returns A.0 (it follows the API's current default dataset);
    • the damage exporter's --event-id now names the Coverage API's postCatEventId tag.

Features

  • Dates are now checked before an export sends anything.
    • Before: a malformed date failed request by request partway through an export, or was dropped. An empty-string cell sent no date filter at all, and the per-AOI columns weren't checked when the file had a survey_resource_id column.
    • Now: every --since/--until and per-AOI since/until value must be a YYYY-MM-DD calendar date, and no AOI's since may be after its until. Otherwise the export stops with a ValueError naming up to five offending AOIs. This applies to the main and standalone Roof Age exporters, and to FeatureApi.get_features_gdf_bulk and RoofAgeApi.get_roof_age_bulk, which used to fall back to the bulk date for a per-row date that wasn't a string.
    • Date-typed columns (from GeoJSON, GeoPackage or typed parquet) are converted, empty or blank cells use the bulk value, and a blank bulk value still means no date.
  • Agent Skill for questions about the APIs and nmaipy's outputs (.agents/skills/nearmap-ai-apis).
    • Run Claude Code, Codex or Gemini CLI from a checkout of the repository and ask why a value, count, area, date or null looks the way it does. Examples: "why is my roof bigger than the lot?", "why does this roof have two ages?", "what does belongs_to_parcel mean?"
    • It covers the AI Feature, Roof Age and Damage Conflation APIs, with claims tagged as verified against the live API, read from nmaipy's code, or inferred.
    • It ships in the repository, not the package.

Deprecations and behaviour changes

  • Deprecated, to be removed in 6.0: nmaipy.constants.CONNECTED_CLASS_IDS and the connected_class_ids argument of geometry_utils.combine_features_from_grid. regrid_on_skip (the argument, and the attribute of FeatureApi and NearmapAIExporter) and --no-regrid-on-skip are deprecated aliases of retry_on_realtime_skip and --no-retry-on-realtime-skip. Both still work and emit a DeprecationWarning. The constant was incomplete and nmaipy no longer uses it, since whether a feature is connected is read from its areas; the argument is ignored.
  • combine_features_from_grid now requires clipped_area_* alongside area_* (it used to fall back to area_sqm alone). It raises if a cell reports an area_sqm equal to neither its clipped nor its unclipped area, or if a feature has an area_sqm in some cells but not others. On a gridded AOI either error fails only that AOI's grid.
  • Date inputs that were accepted before may now be refused (see Features).
  • Gridded AOIs report smaller area_* and <class>_total_area_* than before, and a multi-cell AOI whose scores the API still skips after a retry is now gridded (see Bug Fixes).

Notes

  • Grid cells are queried without parcelMode, by design. Gridding is meant for very large areas, where a feature crossing the outer boundary matters less than features being cut at every internal grid line.
  • The API's clipped area can slightly exceed an object's area. For an object wholly inside the AOI, the Feature API's clippedAreaSqm can exceed areaSqm by a few tenths of a sqm; treat it as measurement noise.
  • Dependencies are unchanged.