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

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Colin Dunklau <colin(dot)dunklau(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: postgres 9.2.2 point conversion from polygon doesn't always give accurate center
Date: 2013-02-03 09:33:19
Message-ID: CAEZATCUoN5VmO5=wOpEi6qJFzf=OcE15pStegBr04qPmykmkTg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 3 February 2013 09:16, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
>> 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.

Although, if that's really how it's being calculated, then that's not
really the centroid.

Consider for example adding an extra redundant point to one side of a square:

polygon '((-1,-1),(-1,0),(-1,1),(1,1),(1,-1))')

that will shift the average X position over to the left, but the
centroid is still at (0,0).

Regards,
Dean

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Simon Riggs 2013-02-03 09:33:34 Re: postgres 9.2.2 point conversion from polygon doesn't always give accurate center
Previous Message Dean Rasheed 2013-02-03 09:16:51 Re: postgres 9.2.2 point conversion from polygon doesn't always give accurate center