Hi all,

I am trying to do obtain the distance between two users on my site,
using code I found in this group. We already have geoDjango installed,
though i'm wondering if my problem comes from being on an old version
(i dont know which version we're using - if somebody could tell me how
to check that would be great). We are running Django 1.1

the code i am using is:

from django.contrib.gis.geos import Point
from django.contrib.gis.measure import D

my_location = request.user.get_profile().location
            their_location = other_user.get_profile().location

            my_location.transform(4326)
            their_location.transform(4326)
            distance = my_location.distance(their_location)

            if request.user.get_profile().get_preferences().use_metric
== 1:
                distance_result =
round(D(m=my_location.distance(their_location)).km, 1)
            else:
                distance_result =
round(D(m=my_location.distance(their_location)).mi, 1)

the last section is just a check to see whether the user wants the
result in miles or km. the bit that's troubles me is the transform()
section. if i put in 4326, i just get 0.0 as the result. if i put in
nothing so it's just transform() (which i understand should use 4326),
i get this django Error:

TypeError at /members/GayHopHelper/

transform() takes at least 2 arguments (1 given)

the only thing that works so far is using SRID 32140, which is for
south texas. the results seem ok but definitely a bit inaccurate,
which is to be expected.

i'm not a Django export at all so maybe this all just comes from being
on an old version of GeoDjango and i need to upgrade. if that's all it
is then sorry for wasting time (i'm not a sys admin and dont know much
about Django so cant upgrade myself easily).

-- 
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.

Reply via email to