本文整理汇总了Python中django.contrib.gis.geos.point.Point方法的典型用法代码示例。如果您正苦于以下问题:Python point.Point方法的具体用法?Python point.Point怎么用?Python point.Point使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.contrib.gis.geos.point
的用法示例。
在下文中一共展示了point.Point方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _post_init
# 需要导入模块: from django.contrib.gis.geos import point [as 别名]
# 或者: from django.contrib.gis.geos.point import Point [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()
示例2: has_cs
# 需要导入模块: from django.contrib.gis.geos import point [as 别名]
# 或者: from django.contrib.gis.geos.point import Point [as 别名]
def has_cs(self):
"Returns True if this Geometry has a coordinate sequence, False if not."
# Only these geometries are allowed to have coordinate sequences.
if isinstance(self, (Point, LineString, LinearRing)):
return True
else:
return False
示例3: project
# 需要导入模块: from django.contrib.gis.geos import point [as 别名]
# 或者: from django.contrib.gis.geos.point import Point [as 别名]
def project(self, point):
if not isinstance(point, Point):
raise TypeError('locate_point argument must be a Point')
if not isinstance(self, (LineString, MultiLineString)):
raise TypeError('locate_point only works on LineString and MultiLineString geometries')
if not hasattr(capi, 'geos_project'):
raise NotImplementedError('geos_project requires GEOS 3.2+')
return capi.geos_project(self.ptr, point.ptr)
示例4: project_normalized
# 需要导入模块: from django.contrib.gis.geos import point [as 别名]
# 或者: from django.contrib.gis.geos.point import Point [as 别名]
def project_normalized(self, point):
if not isinstance(point, Point):
raise TypeError('locate_point argument must be a Point')
if not isinstance(self, (LineString, MultiLineString)):
raise TypeError('locate_point only works on LineString and MultiLineString geometries')
if not hasattr(capi, 'geos_project_normalized'):
raise NotImplementedError('project_normalized requires GEOS 3.2+')
return capi.geos_project_normalized(self.ptr, point.ptr)
示例5: extent
# 需要导入模块: from django.contrib.gis.geos import point [as 别名]
# 或者: from django.contrib.gis.geos.point import Point [as 别名]
def extent(self):
"""
Returns the extent of this geometry as a 4-tuple, consisting of
(xmin, ymin, xmax, ymax).
"""
env = self.envelope
if isinstance(env, Point):
xmin, ymin = env.tuple
xmax, ymax = xmin, ymin
else:
xmin, ymin = env[0][0]
xmax, ymax = env[0][2]
return (xmin, ymin, xmax, ymax)