Skip to content

Pollination: Remove outdated geometry check#2274

Merged
davemfish merged 5 commits intonatcap:mainfrom
megannissel:bugfix/2262-pollination-multipolygonz
Jan 15, 2026
Merged

Pollination: Remove outdated geometry check#2274
davemfish merged 5 commits intonatcap:mainfrom
megannissel:bugfix/2262-pollination-multipolygonz

Conversation

@megannissel
Copy link
Contributor

@megannissel megannissel commented Dec 11, 2025

Description

Fixes #2262

There's a PGP issue and related PR (now merged) for supporting additional geometries beyond Polygon and MultiPolygon in zonal_statistics.

The Pollination model itself has an additional geometry check that contradicts validation behavior, where the spec input geometry_types "POLYGON" and "MULTIPOLYGON" are mapped to several ogr types, i.e.:

'POLYGON': [ogr.wkbPolygon, ogr.wkbPolygonM,
            ogr.wkbPolygonZM, ogr.wkbPolygon25D],
'MULTIPOLYGON': [ogr.wkbMultiPolygon, ogr.wkbMultiPolygonM,
                 ogr.wkbMultiPolygonZM, ogr.wkbMultiPolygon25D]

I opted to remove the check (and the associated test based around it), since this should be caught by validation. If we think there's value in leaving the check (e.g. for CLI users who might not run validation beforehand), we could instead alter the check to use the same geometry list as validation. But it seems like we've been moving away from that in favor of encouraging folks to use the validation functionality (and this would be a redundant check).

One additional point: We may want to wait to merge this in until we do a PGP release that supports the expanded geometry list for zonal_statistics. That said, if we were to merge this prior to an associated PGP release, this model would fail in a way that is consistent with every other model calling zonal_statistics. (HRA, for instance, will also fail if your AOI is a (Multi)Polygon25D/Z/ZM; the failure there will come from PGP itself since the model doesn't have an additional geom check outside of validation, where those geometry types are all allowed.)

Checklist

  • Updated HISTORY.rst and link to any relevant issue (if these changes are user-facing)
  • Updated the user's guide (if needed)
  • Tested the Workbench UI (if relevant)

@megannissel
Copy link
Contributor Author

Workbench test failures are related to #2284 and should be resolved by #2292. We're also planning to update our PGP dependency prior to the next release; see #2295.

@megannissel megannissel marked this pull request as ready for review January 14, 2026 20:30
@megannissel megannissel requested a review from davemfish January 14, 2026 20:30
Copy link
Contributor

@davemfish davemfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@megannissel this looks good. I support the decision to remove the additional check and just rely on validation and the pygeoprocessing check instead.

Just one fix to history is needed.

HISTORY.rst Outdated
evaluating to "not precalculated"
(`#2231 <https://github.com/natcap/invest/issues/2231>`_)

Pollination
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, this was entered under the "3.17.2" heading instead of the "unreleased" heading.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, sorry about that; good catch!

@megannissel megannissel requested a review from davemfish January 15, 2026 16:45
@davemfish davemfish merged commit 90acddb into natcap:main Jan 15, 2026
38 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MultiPolygonZ geometry type causes error in Pollination

2 participants