Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InVEST models don't validate input vector geometry #1374

Closed
dcdenu4 opened this issue Aug 15, 2023 · 1 comment · Fixed by #1430
Closed

InVEST models don't validate input vector geometry #1374

dcdenu4 opened this issue Aug 15, 2023 · 1 comment · Fixed by #1430
Assignees
Labels
bug Something isn't working in progress This issue is actively being worked on

Comments

@dcdenu4
Copy link
Member

dcdenu4 commented Aug 15, 2023

There was a user who was getting odd results on the forums and it turns out they were passing in a watershed vector with a line geometry instead of a polygon.

Can we validate vector geometry type through the MODEL_SPEC?

@dcdenu4 dcdenu4 added the bug Something isn't working label Aug 15, 2023
@davemfish
Copy link
Contributor

Offhand I know that CV does this validation for a few inputs, and it's somewhat verbose, so standardizing the approach sounds nice.

        vector = gdal.OpenEx(args['slr_vector_path'], gdal.OF_VECTOR)
        layer = vector.GetLayer()
        # all OGR point/multipoint codes
        if layer.GetGeomType() not in [
                ogr.wkbPoint, ogr.wkbMultiPoint,
                ogr.wkbPointM, ogr.wkbMultiPointM,
                ogr.wkbPointZM, ogr.wkbMultiPointZM,
                ogr.wkbPoint25D, ogr.wkbMultiPoint25D]:
            validation_warnings.append(
                (['slr_vector_path'], POINT_GEOMETRY_MSG))

@emlys emlys self-assigned this Oct 17, 2023
emlys added a commit to emlys/invest that referenced this issue Oct 17, 2023
emlys added a commit to emlys/invest that referenced this issue Oct 18, 2023
@emlys emlys added the in progress This issue is actively being worked on label Oct 18, 2023
emlys added a commit to emlys/invest that referenced this issue Oct 18, 2023
emlys added a commit to emlys/invest that referenced this issue Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in progress This issue is actively being worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants