Skip to content

GEOSSnap: Preserve Z values from input#1395

Draft
dbaston wants to merge 1 commit into
libgeos:mainfrom
dbaston:snap-zm
Draft

GEOSSnap: Preserve Z values from input#1395
dbaston wants to merge 1 commit into
libgeos:mainfrom
dbaston:snap-zm

Conversation

@dbaston
Copy link
Copy Markdown
Member

@dbaston dbaston commented Mar 9, 2026

No description provided.

@dbaston dbaston added the Enhancement New feature or feature improvement. label Mar 9, 2026
@dbaston dbaston added this to the 3.15.0 milestone Mar 9, 2026
@dbaston
Copy link
Copy Markdown
Member Author

dbaston commented Mar 10, 2026

Need to compare w/JTS and desired behavior. If the geometry to which we snap has Z values, should the snapped geometry assume them?

@dbaston dbaston marked this pull request as draft March 10, 2026 14:28
@dr-jts
Copy link
Copy Markdown
Contributor

dr-jts commented Mar 10, 2026

Need to compare w/JTS and desired behavior.

JTS doesn't address this.

If the geometry to which we snap has Z values, should the snapped geometry assume them?

Makes sense to me

@dbaston
Copy link
Copy Markdown
Member Author

dbaston commented Mar 10, 2026

It appears that JTS does handle this. It takes the Z value from the snapped-to point.

bin/jtsop.sh -a "LINESTRING Z (0.99 0.99 4, 5 5 8)" -b "POINT (1 1 999)" Snapping.snapAtoB 0.1 -f wkt
LINESTRING Z(1 1 999, 5 5 8)

also

bin/jtsop.sh -a "LINESTRING (0.99 0.99, 5 5)" -b "POINT (1 1 999)" Snapping.snapAtoB 0.1 -f wkt
LINESTRING Z(1 1 999, 5 5 NaN)

but

bin/jtsop.sh -a "LINESTRING (5 5, 0.99 0.9)" -b "POINT (1 1 999)" Snapping.snapAtoB 0.1 -f wkt
LINESTRING (5 5, 0.99 0.9)

(after patching GeometryOutput.java to print Z values)

@dr-jts
Copy link
Copy Markdown
Contributor

dr-jts commented Mar 10, 2026

It appears that JTS does handle this. It takes the Z value from the snapped-to point.

That make sense, because the snapped-to point is copied. What about if the snapped point is the one that carries the Z value? A quick inspection of the code makes me think that won't work.

But of course that may or may not be desirable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or feature improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants