#5610 closed defect (fixed)
ST_SetPoint on a line with NaN Z values
Reported by: | 3nids | Owned by: | robe |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.0.11 |
Component: | postgis | Version: | 3.4.x |
Keywords: | Cc: |
Description
Using ST_SetPoint
on a line with a NaN
Z fails
select st_setpoint( st_makeline(ARRAY[ST_MakePoint(1,2,'Nan'), ST_MakePoint(3,4,10), ST_MakePoint(5,6, 20)]), 2, ST_MakePoint(5,6, 'Nan'))
Fails with Geometry contains invalid coordinates
Tested with docker images (postgis/postgis), this fails in Postgis 3.3 and 3.4 but works in 3.1 and 3.2.
What is the correct approach to set several Z values to NaN on a linestring?
Change History (20)
comment:1 by , 14 months ago
comment:2 by , 14 months ago
Milestone: | PostGIS 3.4.1 → PostGIS 3.4.2 |
---|
Why would you want to do this? Nan as an argument breaks so many operations.
But I guess this is a regression since you said it's working in 3.1 even though I don't understand the value of having Nan in a coordinate.
It's possible it broke during the PostgreSQL transition to how they handle floats which I forget when that happened I'm thinking around our postgis 3.2 release
comment:4 by , 13 months ago
Why would you want NULL values in a linestring. Makes sense the who linestring is null, but coordinates in a linestring being NULL? I don't understand the utility of that.
comment:5 by , 13 months ago
I took a closer look at this and traced it back to a commit I made, to prevent a crash
in #5319
I'm deliberating if there is a better solution. I was just assuming these strange things happen not intentionally as I couldn't think of a purpose of why one would need to do this.
comment:6 by , 13 months ago
Owner: | changed from | to
---|
Looking closer at that ticket. It's possible I was mistaken about ST_SetPoint triggering a crash and perhaps I was looking at it nested in another call. Let me do some tests again, taking out that check I put in, and if I can't make it crash, I'll take that logic out.
comment:8 by , 13 months ago
Milestone: | PostGIS 3.4.2 → PostGIS 3.1.11 |
---|
comment:14 by , 13 months ago
Milestone: | PostGIS 3.1.11 → PostGIS 3.0.11 |
---|
I have the question on stack exchange: https://gis.stackexchange.com/questions/470332/st-setpoint-on-a-line-with-nan-z-values