Django django.contrib.gis.db MultiPolygonField 提取点数
Django django.contrib.gis.db MultiPolygonField extract points
我没有找到任何包含字段详细信息的有关 geo dgango 的文档。只有这个 https://docs.djangoproject.com/en/1.9/ref/contrib/gis/model-api/#django.contrib.gis.db.models.MultiPolygonField 但如您所见,它并没有告诉我们字段中有什么以及如何获取它......
在哪里可以找到 MultiPolygonField 等 geodjango 字段的深度视图?
我正在尝试提取 MultiPolygonField 中的所有点。我试过了:
mpoly = models.MultiPolygonField(srid=4326, null=False, blank=False)
def get_tooltip_title(self):
result = "Polygon: [["
for poly in self.mpoly.choices:
for point in poly.coordinates:
result += "("
result += str(point.x)
result += ","
result += str(point.y)
result += "),"
result += "],"
result += "]"
return result
但是该领域没有 "choises",而且我没有找到任何关于该领域的好文档。那么如何获得 MultiPolygonField 的点数呢?
好吧,这太愚蠢了。没有好的文档?!
我在 2009 http://www.paolocorti.net/2009/04/01/a-day-with-geodjango/ 的 post 中找到了解决方案。就像:
class LocationPolygon(models.Model):
mpoly = models.MultiPolygonField(srid=4326, null=False, blank=False)
objects = models.GeoManager()
def get_tooltip_title(self):
return str(self.mpoly.coords)
虽然 geodjango MultiPolygon 没有很好的文档记录,mysql multipolygon 是
A MultiPolygon is a MultiSurface object composed of Polygon elements.
MultiPolygon Examples
On a region map, a MultiPolygon could represent a system of lakes.
postgis MultiPolygon 也有很好的文档和一些可视化示例。
基本上,MultiPolygon 是可以接触但不相交的元素的集合。
我没有找到任何包含字段详细信息的有关 geo dgango 的文档。只有这个 https://docs.djangoproject.com/en/1.9/ref/contrib/gis/model-api/#django.contrib.gis.db.models.MultiPolygonField 但如您所见,它并没有告诉我们字段中有什么以及如何获取它...... 在哪里可以找到 MultiPolygonField 等 geodjango 字段的深度视图?
我正在尝试提取 MultiPolygonField 中的所有点。我试过了:
mpoly = models.MultiPolygonField(srid=4326, null=False, blank=False) def get_tooltip_title(self): result = "Polygon: [[" for poly in self.mpoly.choices: for point in poly.coordinates: result += "(" result += str(point.x) result += "," result += str(point.y) result += ")," result += "]," result += "]" return result
但是该领域没有 "choises",而且我没有找到任何关于该领域的好文档。那么如何获得 MultiPolygonField 的点数呢?
好吧,这太愚蠢了。没有好的文档?!
我在 2009 http://www.paolocorti.net/2009/04/01/a-day-with-geodjango/ 的 post 中找到了解决方案。就像:
class LocationPolygon(models.Model):
mpoly = models.MultiPolygonField(srid=4326, null=False, blank=False)
objects = models.GeoManager()
def get_tooltip_title(self):
return str(self.mpoly.coords)
虽然 geodjango MultiPolygon 没有很好的文档记录,mysql multipolygon 是
A MultiPolygon is a MultiSurface object composed of Polygon elements.
MultiPolygon Examples
On a region map, a MultiPolygon could represent a system of lakes.
postgis MultiPolygon 也有很好的文档和一些可视化示例。
基本上,MultiPolygon 是可以接触但不相交的元素的集合。