Re: postgres 9.2.2 point conversion from polygon doesn't always give accurate center

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: postgres 9.2.2 point conversion from polygon doesn't always give accurate center
Дата
Msg-id 24313.1359757005@sss.pgh.pa.us
обсуждение исходный текст
Ответ на postgres 9.2.2 point conversion from polygon doesn't always give accurate center  (Colin Dunklau <colin.dunklau@gmail.com>)
Ответы Re: postgres 9.2.2 point conversion from polygon doesn't always give accurate center  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список pgsql-bugs
Colin Dunklau <colin.dunklau@gmail.com> writes:
> Hello! I believe I've found a bug in the type conversion process from
> polygon to point.

> In the documentation found here
> http://www.postgresql.org/docs/9.2/interactive/functions-geometry.html,

> Table 9-32 claims that running the point() function on a polygon
> returns the "center of polygon". This is not the case for some
> polygons, as shown below.

It looks like what the code is actually computing is the average X
position and average Y position of the points listed in the polygon.
I'm not sure how defensible that algorithm is (the comment attached
to it mumbles something about how it should be the weighted means
of the line segments instead).  But for non-convex polygons like
these I'm not sure there's any intuitively correct answer.  If you
want us to change the code to produce the answers you exhibit, you'd
better explain (1) how you got them and (2) why that's the right
answer and the current way is wrong.

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Violation of primary key constraint
Следующее
От: Toby Murray
Дата:
Сообщение: Re: Violation of primary key constraint