Centroid of models.PointField()

39 views
Skip to first unread message

cka...@googlemail.com

unread,
Mar 3, 2010, 11:36:41 AM3/3/10
to geodjango
Hi Group,

I want to get the centroid of all Points in my PointField:

class About(models.Model):
user = models.ForeignKey(User)
slug = models.SlugField(blank=True, unique=True, null = True)
origin = models.PointField()
...
objects = models.GeoManager()

Thanks a lot!
Chrstian Karrié

Josh Livni

unread,
Mar 8, 2010, 9:17:45 PM3/8/10
to geodjango
About.objects.all().collect().envelope.centroid

 -Josh



--
You received this message because you are subscribed to the Google Groups "geodjango" group.
To post to this group, send email to geod...@googlegroups.com.
To unsubscribe from this group, send email to geodjango+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/geodjango?hl=en.


cka...@googlemail.com

unread,
Mar 10, 2010, 3:21:10 PM3/10/10
to geodjango
Amazing, works perfect!

Thanks josh

On 9 Mrz., 03:17, Josh Livni <j...@umbrellaconsulting.com> wrote:
> About.objects.all().collect().envelope.centroid
>
>  -Josh
>

> On Wed, Mar 3, 2010 at 8:36 AM, ckar...@googlemail.com <


>
> ckar...@googlemail.com> wrote:
> > Hi Group,
>
> > I want to get the centroid of all Points in my PointField:
>
> > class About(models.Model):
> >    user = models.ForeignKey(User)
> >    slug =  models.SlugField(blank=True, unique=True, null = True)
> >    origin = models.PointField()
> >    ...
> >    objects = models.GeoManager()
>
> > Thanks a lot!
> > Chrstian Karrié
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "geodjango" group.
> > To post to this group, send email to geod...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > geodjango+...@googlegroups.com<geodjango%2Bunsu...@googlegroups.com>

Reply all
Reply to author
Forward
0 new messages