2017-01-31 6 views
0

튜토리얼에서 주어진 점과 점 사이의 거리 계산을 보았습니다.Django 1.8, Postgis 두 점 사이의 거리 쿼리

from django.contrib.gis.db.models.functions import Distance 

그러나 Django 1.8에는 위의 "기능"모듈이 없었습니다. 그럼 아래의 쿼리와 동일한 결과를 어떻게 얻을 수 있습니까?

qs = qs.annotate(distance=Distance('location', pnt)).order_by('distance') 

지리적 데이터베이스 API 문서를 살펴 보았습니다. 하지만 혼란스러워.

답변