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

Be cautious about Nodes with z-coordinate #1854

Open
DanielTollenaar opened this issue Sep 30, 2024 · 0 comments
Open

Be cautious about Nodes with z-coordinate #1854

DanielTollenaar opened this issue Sep 30, 2024 · 0 comments
Labels
python Relates to one of the Ribasim python packages ribasim-nl Related to Ribasim NL project validation Related to model validation

Comments

@DanielTollenaar
Copy link
Contributor

DanielTollenaar commented Sep 30, 2024

What
Received a model with mixed x,y and x,y,z Point geometries in the node-table, e.g.:

image

Adding an edge between these to nodes will cause a validation-error:
image

Why
LineString cannot be drawn between x,y Point and x,y,z Point

How
Suggest to drop z-coordinate in add-API, reading and writing so user doesn't need to drop z-coordinate all the time

Edit 1
This code I use in Ribasim-NL now:

def edge(point_from: Point, point_to: Point) -> LineString:
    """Create a LineString geometry between two Point geometries, dropping z-coordinate if any

    Args:
        point_from (Point): _description_
        point_to (Point): _description_

    Returns
    -------
        LineString: LineString without z-coordinate
    """
    if point_from.has_z:
        point_from = Point(point_from.x, point_from.y)
    if point_to.has_z:
        point_to = Point(point_to.x, point_to.y)
    return LineString((point_from, point_to))
@visr visr added python Relates to one of the Ribasim python packages validation Related to model validation labels Sep 30, 2024
@evetion evetion added the ribasim-nl Related to Ribasim NL project label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Relates to one of the Ribasim python packages ribasim-nl Related to Ribasim NL project validation Related to model validation
Projects
Status: To do
Development

No branches or pull requests

3 participants