我只是在学习geo-django。我可以从一个点找出所有地方的距离。但是当我使用.values方法的注释distance场,我得到 TypeError: Object of type 'Distance' is not JSON serializable 这里是我的代码片段 #models.py
import uuid
from django.contrib.gis.db import mod
假设我有以下型号: class Person:
id = models.BigAutoField(primary_key=True)
name = models.CharField(max_length=150)
location = models.PointField()
我怎么会去使用GeoDjango内置按位置获得k个最近邻(KNN)? 我需要为此编写自
我得到一个错误。 ,我没有IDEIA如何解决它,看看,这是错误: TypeError: as_view() takes 1 positional argument but 2 were given
此,你可以看到是我的“model.py”页面的代码。 from django.db import models
from django.contrib.gis.db import models
我试图从一张表中获取所有记录,这些表的几何与来自同一张表的缓冲几何图形相交,我通过子查询得到这些记录。 我的工作普通的SQL语句是: SELECT id FROM table
WHERE ST_INTERSECTS(geom, (
SELECT ST_BUFFER(geom, 10) FROM table WHERE id = 1)
);
我如何与GeoDjango内置做到这一点?
序幕: 这是SO经常产生的问题: 3d distance calculations with GeoDjango Calculating distance between two points using latitude longitude and altitude (elevation) Distance between two 3D point in geodjango (postgis)
我试图在django模型的字段中存储多个位置,但我不太确定如何去解决它。我正在使用GeoDjango的PointField来存储最新的报告位置。 class Tracker(models.Model):
# Other fields..
# srid 4326 is the WGS84 Spheroid used by GPS
current_pos = model