#457 closed defect (fixed)
ST_CollectionExtract returns non-requested type
Reported by: | strk | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 1.5.3 |
Component: | postgis | Version: | master |
Keywords: | history | Cc: |
Description
strk=# select st_astext(ST_CollectionExtract('POINT(0 0)', 2)); st_astext ------------ POINT(0 0) strk=# select st_astext(ST_CollectionExtract('POINT(0 0)', 3)); st_astext ------------ POINT(0 0)
Attachments (2)
Change History (8)
by , 15 years ago
Attachment: | testcase.patch added |
---|
comment:1 by , 15 years ago
Milestone: | → PostGIS 1.5.1 |
---|
comment:2 by , 15 years ago
Milestone: | PostGIS 1.5.1 → PostGIS 1.5.2 |
---|
comment:3 by , 14 years ago
It looks like this behavior is intended from the comment in the end of lwgeom_functions_basic.c:
/* Mirror non-collections right back */
But I agree that this is no good.
As the documentation is written now, it should definitly give an error message if the inputed geometry is not a collection, but it would also make sense as in the testcase.patch, the inputed geometry is mirrored if and only if it is of the type that is asked for. But then that should be reflected in the documentation to.
I can do the changes if someone decides which way to go
/Nicklas
comment:4 by , 14 years ago
I add a patch that should give the results expected in testcase.patch So it should return the asked for type even if it is not in a collection.
But I have done nothing about the documentation.
If we go this way the function name is a little misleading. It maybe should have been something like ST_TypeExtract instead. But that is nothing for a minor release and I guess that is no big deal.
Or should we give an error message instead if function is feed with else than collection.
Or maybe, always return an empty collection when inputed geometry is not collection with a notice?
But it might be quite useful to just get everything of the asked for type even if it is no collection.
/Nicklas
by , 14 years ago
Attachment: | collectionextract.patch added |
---|
only mirrors back non collection cases if type is the requested
comment:5 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:6 by , 13 years ago
Keywords: | history added |
---|
regression testcase (tickets)