Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » GeoDjango: Measure distance between two points. [RSS Feed]

#1 June 13, 2010 08:46:24

Tyler A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

GeoDjango: Measure distance between two points.


I'm trying to figure out how to take two Point objects and determine
the distance between them.

It seems that it is trivial to search the DB (well, provided that I'm
not using mySQL, which I am) to filter by distance, however, that's
not what I'm looking for at the moment.

I have a set of Point objects, and I'd like to compute the distance in
miles for each.

For Point objects a, b, one can "a.distance(b)", however, a number is
returned not a Distance object. I'm having trouble finding
documentation on what this value represents (I could perhaps plug it
into D(????=a.distance(b)).mi).

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 June 13, 2010 17:57:02

Daniel H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

GeoDjango: Measure distance between two points.


On 13 June 2010 06:24, Tyler Andersen <bigbrot...@gmail.com> wrote:
> I'm trying to figure out how to take two Point objects and determine
> the distance between them.
>
> It seems that it is trivial to search the DB (well, provided that I'm
> not using mySQL, which I am) to filter by distance, however, that's
> not what I'm looking for at the moment.
>
> I have a set of Point objects, and I'd like to compute the distance in
> miles for each.
>
> For Point objects a, b, one can "a.distance(b)", however, a number is
> returned not a Distance object. I'm having trouble finding
> documentation on what this value represents (I could perhaps plug it
> into D(????=a.distance(b)).mi).

Try this query on the Geodjango list:http://groups.google.com/group/geodjangoBut to try and answer your question:

Are you trying to get the distance of a set of objects from a point?

So for example, say you were looking for houses from a railway
station? Or are you looking at finding the distance between each of a
set of points that have an order? Like waypoints on a path?

As for what metric it returns, I'd say have a look at the documentation here:http://docs.djangoproject.com/en/dev/ref/contrib/gis/db-api/#distance-lookupsHope that helps,
Cheers,
Dan







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



--
Dan Hilton
============================
www.twitter.com/danhilton
www.DanHilton.co.uk
============================

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 June 14, 2010 03:42:21

Tyler A.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

GeoDjango: Measure distance between two points.


On Jun 13, 9:56 am, Daniel Hilton <daniel.hil...@gmail.com> wrote:
> On 13 June 2010 06:24, Tyler Andersen <bigbrot...@gmail.com> wrote:
>
> > I'm trying to figure out how to take two Point objects and determine
> > the distance between them.
>
> > It seems that it is trivial to search the DB (well, provided that I'm
> > not using mySQL, which I am) to filter by distance, however, that's
> > not what I'm looking for at the moment.
>
> > I have a set of Point objects, and I'd like to compute the distance in
> > miles for each.
>
> > For Point objects a, b, one can "a.distance(b)", however, a number is
> > returned not a Distance object. I'm having trouble finding
> > documentation on what this value represents (I could perhaps plug it
> > into D(????=a.distance(b)).mi).
>
> Try this query on the Geodjango list:http://groups.google.com/group/geodjangoThanks, I'll re-post there.

>
> But to try and answer your question:
>
> Are you trying to get the distance of a set of objects from a point?
>
> So for example, say you were looking for houses from a railway
> station? Or are you looking at finding the distance between each of a
> set of points that have an order? Like waypoints on a path?
>
> As for what metric it returns, I'd say have a look at the documentation
> here:http://docs.djangoproject.com/en/dev/ref/contrib/gis/db-api/#distance...


For simplicity, I'd just like to address the case of measuring the
distance between two points. No DB involved.

Tyler


>
> Hope that helps,
> Cheers,
> Dan
>
>
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group
> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> Dan Hilton
> ============================www.twitter.com/danhiltonwww.DanHilton.co.uk
> ============================

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » GeoDjango: Measure distance between two points. [RSS Feed]

Board footer

Moderator control

Enjoy the 13th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support