我们可以通过这个获得特定引脚的区域:
>>> from tbl.models import *
>>> from django.contrib.gis.geos import *
>>> pnt = ButuanMaps.objects.get(clandpin='162-03-0001-017-33').geom
>>> pnt = ButuanMaps.objects.get(clandpin='162-03-0001-017-33')
>>> pnt = ButuanMaps.objects.get(clandpin='162-03-0001-017-33').geom
>>> pnt.area
4947.0185203032115
如何获得所有引脚的所有区域?
答案 0 :(得分:0)
我是这样做的:
>>> distincts = ButuanMaps.objects.order_by('id').values_list('clandpin', flat=True)[:10]
>>> for value in distincts:print (reduce(lambda a,x: x.calculated_area.sq_m, ButuanMaps.objects.filter(clandpin=value).area(model_att='calculated_area'), Area(0)),value)