本文整理汇总了Python中django.contrib.gis.geos.polygon.Polygon方法的典型用法代码示例。如果您正苦于以下问题:Python polygon.Polygon方法的具体用法?Python polygon.Polygon怎么用?Python polygon.Polygon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.contrib.gis.geos.polygon
的用法示例。
在下文中一共展示了polygon.Polygon方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: length
# 需要导入模块: from django.contrib.gis.geos import polygon [as 别名]
# 或者: from django.contrib.gis.geos.polygon import Polygon [as 别名]
def length(self):
"""
Returns the length of this Geometry (e.g., 0 for point, or the
circumfrence of a Polygon).
"""
return capi.geos_length(self.ptr, byref(c_double()))
示例2: write
# 需要导入模块: from django.contrib.gis.geos import polygon [as 别名]
# 或者: from django.contrib.gis.geos.polygon import Polygon [as 别名]
def write(self, geom):
"Returns the WKB representation of the given geometry."
from django.contrib.gis.geos import Polygon
geom = self._handle_empty_point(geom)
wkb = wkb_writer_write(self.ptr, geom.ptr, byref(c_size_t()))
if isinstance(geom, Polygon) and geom.empty:
# Fix GEOS output for empty polygon.
# See https://trac.osgeo.org/geos/ticket/680.
wkb = wkb[:-8] + b'\0' * 4
return six.memoryview(wkb)
示例3: write_hex
# 需要导入模块: from django.contrib.gis.geos import polygon [as 别名]
# 或者: from django.contrib.gis.geos.polygon import Polygon [as 别名]
def write_hex(self, geom):
"Returns the HEXEWKB representation of the given geometry."
from django.contrib.gis.geos.polygon import Polygon
geom = self._handle_empty_point(geom)
wkb = wkb_writer_write_hex(self.ptr, geom.ptr, byref(c_size_t()))
if isinstance(geom, Polygon) and geom.empty:
wkb = wkb[:-16] + b'0' * 8
return wkb
# ### WKBWriter Properties ###
# Property for getting/setting the byteorder.
示例4: _post_init
# 需要导入模块: from django.contrib.gis.geos import polygon [as 别名]
# 或者: from django.contrib.gis.geos.polygon import Polygon [as 别名]
def _post_init(self, srid):
"Helper routine for performing post-initialization setup."
# Setting the SRID, if given.
if srid and isinstance(srid, int): self.srid = srid
# Setting the class type (e.g., Point, Polygon, etc.)
self.__class__ = GEOS_CLASSES[self.geom_typeid]
# Setting the coordinate sequence for the geometry (will be None on
# geometries that do not have coordinate sequences)
self._set_cs()
示例5: geom_type
# 需要导入模块: from django.contrib.gis.geos import polygon [as 别名]
# 或者: from django.contrib.gis.geos.polygon import Polygon [as 别名]
def geom_type(self):
"Returns a string representing the Geometry type, e.g. 'Polygon'"
return capi.geos_type(self.ptr).decode()
示例6: convex_hull
# 需要导入模块: from django.contrib.gis.geos import polygon [as 别名]
# 或者: from django.contrib.gis.geos.polygon import Polygon [as 别名]
def convex_hull(self):
"""
Returns the smallest convex Polygon that contains all the points
in the Geometry.
"""
return self._topology(capi.geos_convexhull(self.ptr))