Repository navigation
v5.4.0
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_*andunclipped_area_*are unchanged. - Exports of gridded AOIs made with earlier versions will differ on
area_*and<class>_total_area_*.
- Before: when an AOI was gridded (over about 1 sq km, or after a size error),
- 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
roofSpotlightIndexorhurricaneScoreas{"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_parcelis null. Its parcel-level aggregate comes from the first response.
- Before: when the Feature API returned an include such as
- 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_presentwas described as asphalt shingles, andtree_overhang_ratioandmetal_presentas score-model inputs. Thebelongs_to_parceldescription is also corrected. - Help text:
--untilno longer calls itself the earliest date;--roof-age-datasetno longer sayslatestreturns A.0 (it follows the API's current default dataset);- the damage exporter's
--event-idnow names the Coverage API'spostCatEventIdtag.
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_idcolumn. - Now: every
--since/--untiland per-AOIsince/untilvalue must be aYYYY-MM-DDcalendar date, and no AOI's since may be after its until. Otherwise the export stops with aValueErrornaming up to five offending AOIs. This applies to the main and standalone Roof Age exporters, and toFeatureApi.get_features_gdf_bulkandRoofAgeApi.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.
- 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
- 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_IDSand theconnected_class_idsargument ofgeometry_utils.combine_features_from_grid.regrid_on_skip(the argument, and the attribute ofFeatureApiandNearmapAIExporter) and--no-regrid-on-skipare deprecated aliases ofretry_on_realtime_skipand--no-retry-on-realtime-skip. Both still work and emit aDeprecationWarning. 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_gridnow requiresclipped_area_*alongsidearea_*(it used to fall back toarea_sqmalone). It raises if a cell reports anarea_sqmequal to neither its clipped nor its unclipped area, or if a feature has anarea_sqmin 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
clippedAreaSqmcan exceedareaSqmby a few tenths of a sqm; treat it as measurement noise. - Dependencies are unchanged.