Hello,

Am I the only one having this problem ? Nobody can help me ?
If this does not work, is there a workaround ?

Thank you

On 2 juil, 11:38, orgoz <org...@gmail.com> wrote:
> Hi,
>
> This is my first message here, and I am sorry for my poor english...
>
> I am trying to excecute some distance lookup but I have a problem to
> use the ST_Distance_sphere postgis function.
>
> In Django documentation, I read this (http://docs.djangoproject.com/en/
> dev/ref/contrib/gis/geoquerysets/#id7):
>
> "On every distance lookup but dwithin, an optional third element,
> 'spheroid', may be included to tell GeoDjango to use the more accurate
> spheroid distance calculation functions on fields with a geodetic
> coordinate system (e.g., ST_Distance_Spheroid would be used instead of
> ST_Distance_Sphere)."
>
> But when I try to execute a distance lookup with 'distance_lte' on a
> Postgis 1.5 database, the query is executed with "ST_Distance" instead
> of "ST_Distance_sphere". Why ? Did I forget something ?
>
> This is my code :
>
> stations = Station.objects.filter(point__distance_lte=(pnt,
> D(km=10))).count()
> from django.db import connection
> print connection.queries
>
> Which returns this :
> [{'time': '0.144', 'sql': 'SELECT "spatial_ref_sys"."srid",
> "spatial_ref_sys"."auth_name", "spatial_ref_sys"."auth_srid",
> "spatial_ref_sys"."srtext", "spatial_ref_sys"."proj4text" FROM
> "spatial_ref_sys" WHERE "spatial_ref_sys"."srid" = 900913 '}, {'time':
> '0.903', 'sql': 'SELECT COUNT(*) FROM "prices_station" WHERE
> ST_Distance("prices_station"."point", ST_GeomFromEWKB(E\'\\\\001\\\
> \001\\\\000\\\\000 1\\\\277\\\\015\\\\000\\\\270\\\\036\\\\205\\\\353Q\
> \\\270\\\\372\\\\277h\\\\341z\\\\024\\\\256\\\\0...@\'::bytea)) <=
> 10000.0'}]
>
> Thanks a lot
> Regards.

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