小编Ope*_*mic的帖子

为什么不序列化捕获注释字段?

我不知道将数据添加到查询集会如此困难。就像,如果它不是直接来自数据库,那么它也可能不存在。即使我注释,新字段也是二等公民,并不总是可用。

为什么不序列化捕获我的注释字段?

模型

class Parc(models.Model):
    # Regular Django fields corresponding to the attributes in the
    # world borders shapefile.
    prop_id = models.IntegerField(unique=True)  # OBJECTID: Integer (10.0)
    shp_id = models.IntegerField()

    # GeoDjango-specific: a geometry field (MultiPolygonField)
    mpoly = models.MultiPolygonField(srid=2277)
    sale_price = models.DecimalField(max_digits=8, decimal_places=2, null=True)
    floorplan_area = models.DecimalField(max_digits=8, decimal_places=2, null=True)
    price_per_area = models.DecimalField(max_digits=8, decimal_places=2, null=True)
    nbhd = models.CharField(max_length=200, null=True)
    # Returns the string representation of the model.
    def __str__(self):              # __unicode__ on Python 2
        return str(self.shp_id)
Run Code Online (Sandbox Code Playgroud)

询问:

parcels = Parc.objects\
    .filter(prop_id__in=attrList)\
    .order_by('prop_id') …
Run Code Online (Sandbox Code Playgroud)

django annotate geojson

6
推荐指数
1
解决办法
1777
查看次数

pygdal 版本配置错误

我正在尝试使用 pip 安装 pygdal,但出现版本不匹配(2.2.1 与 2.2.0)。我认为python的版本不正确。我正在安装 gdal,但它给了我 1.11 版,所以我从 osgeo4mac 安装了 gdal2,它给了我最新版本 2.2.1,但它无法匹配 v2.2.0。

pip list | grep GDAL
GDAL (2.2.1)

$ gdal-config --version
2.2.1

$ pip install pygdal
Collecting pygdal
  Using cached pygdal-2.2.0.3.tar.gz
Requirement already satisfied: numpy>=1.0.0 in /usr/local/lib/python3.6/site-packages (from pygdal)
Building wheels for collected packages: pygdal
  Running setup.py bdist_wheel for pygdal ... error
  Complete output from command /usr/local/opt/python3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/rc/jqv1jd_s4b73mtzpsgyj7y6w0000gp/T/pip-build-fz5kkddd/pygdal/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/rc/jqv1jd_s4b73mtzpsgyj7y6w0000gp/T/tmp0j5fgt_7pip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running …
Run Code Online (Sandbox Code Playgroud)

python pip gdal geodjango

3
推荐指数
1
解决办法
1494
查看次数

标签 统计

annotate ×1

django ×1

gdal ×1

geodjango ×1

geojson ×1

pip ×1

python ×1