-
Notifications
You must be signed in to change notification settings - Fork 4.1k
geo: SpatialObjectToWKT() omits empty shapes in collections #53632
Copy link
Copy link
Closed
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.O-communityOriginated from the communityOriginated from the community
Description
Describe the problem
While implementing ST_ForceCollection, I have a test case which generates a geometry collection with an empty point. However, calling geo.SpatialObjectToWKT omits the empty point from the output.
To Reproduce
func TestEmptyPointWKT(t *testing.T) {
gc := geom.NewGeometryCollection().SetSRID(int(geopb.DefaultGeographySRID))
gc.MustPush(geom.NewPointEmpty(geom.XY))
g, err := geo.MakeGeographyFromGeomT(gc)
require.NoError(t, err)
wkt, err := geo.SpatialObjectToWKT(g.SpatialObject(), 0)
require.NoError(t, err)
require.EqualValues(t, "GEOMETRYCOLLECTION (POINT EMPTY)", wkt)
}This yields a test failure:
Not equal:
expected: string("GEOMETRYCOLLECTION (POINT EMPTY)")
actual : geopb.WKT("GEOMETRYCOLLECTION EMPTY")
PostGIS can represent this just fine:
postgis=# select st_astext(st_forcecollection('POINT EMPTY'));
st_astext
---------------------------------
GEOMETRYCOLLECTION(POINT EMPTY)
(1 row)
Environment:
- CockroachDB version:
masterat8b91062f93 - Server OS: macOS
- Client app:
cockroach demo
CC @otan
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.O-communityOriginated from the communityOriginated from the community