[R-sig-Geo] Find a circle center with spatial points

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Fri Mar 18 18:36:58 CET 2016

On Fri, Mar 18, 2016 at 2:43 PM, Alex Mandel <tech_dev at wildintellect.com> wrote:
> library(rgeos)
> gCentroid
> http://www.rdocumentation.org/packages/rgeos/functions/topo-unary-gCentroid
> Assuming its a circle that would be the center.

Only if you have points uniformly (or uniform-randomly) distributed
round the full extent of the circle. From Adrien's plot it looks like
he's got an arc there.

 It seems more like a three-parameter optimisation problem. Find x, y,
and r that define the circle that minimises the sum of squared
distances from data points to the circle.

 I'm not sure how you'd choose a good initial x,y,r for your optimiser
since I suspect the surface you're optimising over is not unimodal...
You could try taking lots of random samples of three points from your
data and computing the unique circle that fits those points, then
using the mean (or possibly median, there's a fair chance of massive
outliers) value as the initial values.

A quick googling has actually found this little paper on the subject:


So I'll shut up now.


More information about the R-sig-Geo mailing list