Skip to content

Commit 423f69a

Browse files
committed
Allow single-point polygons to be converted to circles
This allows finding the center of a single-point polygon and converting it to a point. Per report from Josef Grahn
1 parent 8457d0b commit 423f69a

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/backend/utils/adt/geo_ops.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5191,7 +5191,7 @@ poly_circle(PG_FUNCTION_ARGS)
51915191
CIRCLE *circle;
51925192
int i;
51935193

5194-
if (poly->npts < 2)
5194+
if (poly->npts < 1)
51955195
ereport(ERROR,
51965196
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
51975197
errmsg("cannot convert empty polygon to circle")));
@@ -5214,11 +5214,6 @@ poly_circle(PG_FUNCTION_ARGS)
52145214
circle->radius += point_dt(&poly->p[i], &circle->center);
52155215
circle->radius /= poly->npts;
52165216

5217-
if (FPzero(circle->radius))
5218-
ereport(ERROR,
5219-
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
5220-
errmsg("cannot convert empty polygon to circle")));
5221-
52225217
PG_RETURN_CIRCLE_P(circle);
52235218
}
52245219

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy