Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#1054 closed defect (fixed)

ZM mixup (ST_Summary giving screwy answers)

Reported by: robe Owned by: strk
Priority: critical Milestone: PostGIS 2.0.0
Component: postgis Version: trunk
Keywords: Cc:

Description

Paul,

I was about to do #649 and while I was at it change to use new SQL/MM proper syntax when I noticed ST_Summary is giving what I consider the wrong answers.

SELECT ST_Summary(ST_GeomFromEWKT('LINESTRING Z(0 0 1, 1 1 1)'));

yields:
LineString[M] with 2 points
 

huh -- where is my M? Same issue with:

SELECT ST_Summary(ST_GeomFromEWKT('POLYGON Z((0 0 1, 1 1 2, 1 2 3, 1 1 1, 0 0 1))'));

same answer with:

SELECT ST_Summary(ST_GeomFromEWKT('POLYGON((0 0 1, 1 1 2, 1 2 3, 1 1 1, 0 0 1))'))

I get:
Polygon[ZM] with 1 rings
   ring 0 has 5 points

Note: this is different form what we have documented. I never did know what that B meant though. Also note that Mike Toews output has changed as well - refer to #649

His now gives this:

SELECT st_summary('SRID=4326;MULTILINESTRING((0 0 0 0, 1 1 1 1),
(2 2 2 2, 3 3 3 3))');


  MultiLineString[ZB] with 2 elements
  LineString[M] with 2 points
  LineString[M] with 2 points

strk -- can you let me know what to put for these bracket flags and confirm what they should be returning?

Change History (9)

comment:1 Changed 8 years ago by pramsey

B means 'has cached box'

comment:2 Changed 8 years ago by strk

gah, I'm seeing dragons about flags too ! I'm having these ZB wrappers containing M geoms. Maybe a make install with GSERIALIZED on and no dump/reload gives this ? NOTE: st_force_2d() doesn't drop that Z either.

I guess I can't escape from a dump/reload at this time, or it'll be hard to tell what's going on.

comment:3 Changed 8 years ago by strk

NOTE that ST_MemSize where giving "big" size for the version marked with 'M', whereas ST_AsEWKTK wasn't showing the M. That's to say the bug is not necessarely limited to ST_Summary.

comment:4 Changed 8 years ago by strk

There used to be a FLAGS_GET_FLAGS or similar macro, clearing from the flags byte all bits not related to "flags" (it: type bits). Lack of it might be related to this bug.

comment:5 Changed 8 years ago by strk

Ok, dump/reload completed. Still having the same problem. I'll file a new ticket for the ST_MemSize.

comment:6 Changed 8 years ago by strk

Owner: changed from pramsey to strk
Status: newassigned

comment:7 Changed 8 years ago by strk

Resolution: fixed
Status: assignedclosed

ST_Summary fixed in r7449. The commit is likely instructive to fix the others...

comment:8 Changed 8 years ago by strk

Oh: a regress test for ST_Summary would be nice to have. Do we need another ticket for that ? Volunteers ? (good thing about a conference in French: I can fix bugs instead of following...)

comment:9 Changed 8 years ago by strk

Final thing: ST_MemSize wasn't wrong, it was an unrelated issue (multi* vs. single)

Note: See TracTickets for help on using tickets.