geodjango

    2热度

    2回答

    我想检索一些职位,取决于他们的地理位置邻近。 正如您在代码中看到的,我正在使用GeoDjango,代码在视图中执行。 问题是距离过滤器似乎被完全忽略。 当我检查查询集的距离时,我得到预期的距离(1米和18公里),但18公里的职位不应该被检索。 def get(self, request, format=None): latlon=request.query_params pnt

    1热度

    1回答

    我只是在学习geo-django。我可以从一个点找出所有地方的距离。但是当我使用.values方法的注释distance场,我得到 TypeError: Object of type 'Distance' is not JSON serializable 这里是我的代码片段 #models.py import uuid from django.contrib.gis.db import mod

    2热度

    1回答

    假设我有以下的数据模型 Person(models.Model): id = models.BigAutoField(primary_key=True) name = models.CharField(max_length=50) location = models.PointField(srid=4326) 假设也说我有一个应用程序,使得查询此Django的

    2热度

    1回答

    假设我有以下型号: class Person: id = models.BigAutoField(primary_key=True) name = models.CharField(max_length=150) location = models.PointField() 我怎么会去使用GeoDjango内置按位置获得k个最近邻(KNN)? 我需要为此编写自

    1热度

    1回答

    我得到一个错误。 ,我没有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

    2热度

    2回答

    我正在尝试使用geodjango查找最近的位置。 我尝试使用下面的代码: LocationInfo.objects.filter(coordinates__distance_lte=(user_location, D(km=2))) ,但它只有在位置是规定的距离(D(km=2)在这种情况下)内工作。 我需要在查询期间找到离用户最近的点,而不使用任何限制。

    2热度

    2回答

    我试图从一张表中获取所有记录,这些表的几何与来自同一张表的缓冲几何图形相交,我通过子查询得到这些记录。 我的工作普通的SQL语句是: SELECT id FROM table WHERE ST_INTERSECTS(geom, ( SELECT ST_BUFFER(geom, 10) FROM table WHERE id = 1) ); 我如何与GeoDjango内置做到这一点?

    4热度

    2回答

    序幕: 这是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)

    1热度

    1回答

    当我尝试Extent聚合 我得到一个字符串而不是预期的4元组。 为了解释: 这工作: >>> Community.objects.annotate(extent=Extent('geometry')).get(...).extent (2726459.05875, 1220672.3825, 2736397.89, 1227645.2375) 以及本: >>> Community.objec

    1热度

    1回答

    我试图在django模型的字段中存储多个位置,但我不太确定如何去解决它。我正在使用GeoDjango的PointField来存储最新的报告位置。 class Tracker(models.Model): # Other fields.. # srid 4326 is the WGS84 Spheroid used by GPS current_pos = model