[postgis-tickets] [PostGIS] #4858: ST_DumpPoints ring indices are inconsistent with ST_DumpRings and ST_InteriorRingN
PostGIS
trac at osgeo.org
Thu Feb 18 14:29:53 PST 2021
#4858: ST_DumpPoints ring indices are inconsistent with ST_DumpRings and
ST_InteriorRingN
---------------------+---------------------------
Reporter: mdavis | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 3.1.2
Component: postgis | Version: 2.5.x
Keywords: |
---------------------+---------------------------
`ST_DumpPoints` produces polygon ring indices which start at 1, for the
shell, and 2 and up for holes. This is inconsistent with `ST_DumpRings`,
which produces index 0 for the shell, and 1 and up for holes. It is also
inconsistent with `ST_InteriorRingN`, which numbers holes starting at 1.
Note that `ST_InteriorRingN` uses OGC standard numbering, which is
1-based.
It would be good to have consistency between functions, conformity with
the standard, and avoid arithmetic to adjust indexes. Perhaps
`ST_DumpPoints` should be changed to number rings starting at 0.
For example:
{{{
SELECT dmp.path, ST_AsText(dmp.geom)
FROM ST_DumpPoints('POLYGON (( 3 0, 3 3, 6 3, 6 0, 3 0 ), ( 5 1, 4 2, 5 2,
5 1 ))':: geometry) AS dmp;
path | st_astext
-------+------------
{1,1} | POINT(3 0)
{1,2} | POINT(3 3)
{1,3} | POINT(6 3)
{1,4} | POINT(6 0)
{1,5} | POINT(3 0)
{2,1} | POINT(5 1)
{2,2} | POINT(4 2)
{2,3} | POINT(5 2)
{2,4} | POINT(5 1)
}}}
but:
{{{
SELECT dmp.path, ST_AsText(dmp.geom)
FROM ST_DumpRings('POLYGON (( 3 0, 3 3, 6 3, 6 0, 3 0 ), ( 5 1, 4 2, 5 2,
5 1 ))':: geometry) AS dmp;
path | st_astext
------+--------------------------------
{0} | POLYGON((3 0,3 3,6 3,6 0,3 0))
{1} | POLYGON((5 1,4 2,5 2,5 1))
}}}
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4858>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list