当前位置: 首页>>代码示例>>Python>>正文


Python error.GEOSException方法代码示例

本文整理汇总了Python中django.contrib.gis.geos.error.GEOSException方法的典型用法代码示例。如果您正苦于以下问题:Python error.GEOSException方法的具体用法?Python error.GEOSException怎么用?Python error.GEOSException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.contrib.gis.geos.error的用法示例。


在下文中一共展示了error.GEOSException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ogr

# 需要导入模块: from django.contrib.gis.geos import error [as 别名]
# 或者: from django.contrib.gis.geos.error import GEOSException [as 别名]
def ogr(self):
        "Returns the OGR Geometry for this Geometry."
        if not gdal.HAS_GDAL:
            raise GEOSException('GDAL required to convert to an OGRGeometry.')
        if self.srid:
            try:
                return gdal.OGRGeometry(self.wkb, self.srid)
            except SRSException:
                pass
        return gdal.OGRGeometry(self.wkb) 
开发者ID:0daybug,项目名称:DjangoBlog,代码行数:12,代码来源:geometry.py

示例2: _set_list

# 需要导入模块: from django.contrib.gis.geos import error [as 别名]
# 或者: from django.contrib.gis.geos.error import GEOSException [as 别名]
def _set_list(self, length, items):
        ndim = self._cs.dims
        hasz = self._cs.hasz  # I don't understand why these are different

        # create a new coordinate sequence and populate accordingly
        cs = GEOSCoordSeq(capi.create_cs(length, ndim), z=hasz)
        for i, c in enumerate(items):
            cs[i] = c

        ptr = self._init_func(cs.ptr)
        if ptr:
            capi.destroy_geom(self.ptr)
            self.ptr = ptr
            self._post_init(self.srid)
        else:
            # can this happen?
            raise GEOSException('Geometry resulting from slice deletion was invalid.') 
开发者ID:KimJangHyeon,项目名称:NarshaTech,代码行数:19,代码来源:linestring.py

示例3: __setstate__

# 需要导入模块: from django.contrib.gis.geos import error [as 别名]
# 或者: from django.contrib.gis.geos.error import GEOSException [as 别名]
def __setstate__(self, state):
        # Instantiating from the tuple state that was pickled.
        wkb, srid = state
        ptr = wkb_r().read(six.memoryview(wkb))
        if not ptr:
            raise GEOSException('Invalid Geometry loaded from pickled state.')
        self.ptr = ptr
        self._post_init(srid)

    # Comparison operators 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:12,代码来源:geometry.py

示例4: relate_pattern

# 需要导入模块: from django.contrib.gis.geos import error [as 别名]
# 或者: from django.contrib.gis.geos.error import GEOSException [as 别名]
def relate_pattern(self, other, pattern):
        """
        Returns true if the elements in the DE-9IM intersection matrix for the
        two Geometries match the elements in pattern.
        """
        if not isinstance(pattern, six.string_types) or len(pattern) > 9:
            raise GEOSException('invalid intersection matrix pattern')
        return capi.geos_relatepattern(self.ptr, other.ptr, force_bytes(pattern)) 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:10,代码来源:geometry.py

示例5: ogr

# 需要导入模块: from django.contrib.gis.geos import error [as 别名]
# 或者: from django.contrib.gis.geos.error import GEOSException [as 别名]
def ogr(self):
        "Returns the OGR Geometry for this Geometry."
        if not gdal.HAS_GDAL:
            raise GEOSException('GDAL required to convert to an OGRGeometry.')
        if self.srid:
            try:
                return gdal.OGRGeometry(self.wkb, self.srid)
            except gdal.SRSException:
                pass
        return gdal.OGRGeometry(self.wkb) 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:12,代码来源:geometry.py

示例6: _set_list

# 需要导入模块: from django.contrib.gis.geos import error [as 别名]
# 或者: from django.contrib.gis.geos.error import GEOSException [as 别名]
def _set_list(self, length, items):
        ptr = self._create_point(length, items)
        if ptr:
            capi.destroy_geom(self.ptr)
            self._ptr = ptr
            self._set_cs()
        else:
            # can this happen?
            raise GEOSException('Geometry resulting from slice deletion was invalid.') 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:11,代码来源:point.py

示例7: set_z

# 需要导入模块: from django.contrib.gis.geos import error [as 别名]
# 或者: from django.contrib.gis.geos.error import GEOSException [as 别名]
def set_z(self, value):
        "Sets the Z component of the Point."
        if self.hasz:
            self._cs.setOrdinate(2, 0, value)
        else:
            raise GEOSException('Cannot set Z on 2D Point.')

    # X, Y, Z properties 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:10,代码来源:point.py

示例8: check_geom

# 需要导入模块: from django.contrib.gis.geos import error [as 别名]
# 或者: from django.contrib.gis.geos.error import GEOSException [as 别名]
def check_geom(result, func, cargs):
    "Error checking on routines that return Geometries."
    if not result:
        raise GEOSException('Error encountered checking Geometry returned from GEOS C function "%s".' % func.__name__)
    return result 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:7,代码来源:errcheck.py

示例9: check_minus_one

# 需要导入模块: from django.contrib.gis.geos import error [as 别名]
# 或者: from django.contrib.gis.geos.error import GEOSException [as 别名]
def check_minus_one(result, func, cargs):
    "Error checking on routines that should not return -1."
    if result == -1:
        raise GEOSException('Error encountered in GEOS C function "%s".' % func.__name__)
    else:
        return result 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:8,代码来源:errcheck.py

示例10: check_predicate

# 需要导入模块: from django.contrib.gis.geos import error [as 别名]
# 或者: from django.contrib.gis.geos.error import GEOSException [as 别名]
def check_predicate(result, func, cargs):
    "Error checking for unary/binary predicate functions."
    val = ord(result)  # getting the ordinal from the character
    if val == 1:
        return True
    elif val == 0:
        return False
    else:
        raise GEOSException('Error encountered on GEOS C predicate function "%s".' % func.__name__) 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:11,代码来源:errcheck.py

示例11: check_string

# 需要导入模块: from django.contrib.gis.geos import error [as 别名]
# 或者: from django.contrib.gis.geos.error import GEOSException [as 别名]
def check_string(result, func, cargs):
    """
    Error checking for routines that return strings.

    This frees the memory allocated by GEOS at the result pointer.
    """
    if not result:
        raise GEOSException('Error encountered checking string return value in GEOS C function "%s".' % func.__name__)
    # Getting the string value at the pointer address.
    s = string_at(result)
    # Freeing the memory allocated within GEOS
    free(result)
    return s 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:15,代码来源:errcheck.py

示例12: check_zero

# 需要导入模块: from django.contrib.gis.geos import error [as 别名]
# 或者: from django.contrib.gis.geos.error import GEOSException [as 别名]
def check_zero(result, func, cargs):
    "Error checking on routines that should not return 0."
    if result == 0:
        raise GEOSException('Error encountered in GEOS C function "%s".' % func.__name__)
    else:
        return result 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:8,代码来源:errcheck.py

示例13: _get_ptr

# 需要导入模块: from django.contrib.gis.geos import error [as 别名]
# 或者: from django.contrib.gis.geos.error import GEOSException [as 别名]
def _get_ptr(self):
        # Raise an exception if the pointer isn't valid don't
        # want to be passing NULL pointers to routines --
        # that's very bad.
        if self._ptr:
            return self._ptr
        else:
            raise GEOSException('NULL GEOS %s pointer encountered.' % self.__class__.__name__) 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:10,代码来源:base.py

示例14: _checkdim

# 需要导入模块: from django.contrib.gis.geos import error [as 别名]
# 或者: from django.contrib.gis.geos.error import GEOSException [as 别名]
def _checkdim(self, dim):
        "Checks the given dimension."
        if dim < 0 or dim > 2:
            raise GEOSException('invalid ordinate dimension "%d"' % dim)

    # #### Ordinate getting and setting routines #### 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:8,代码来源:coordseq.py

示例15: geos_version_info

# 需要导入模块: from django.contrib.gis.geos import error [as 别名]
# 或者: from django.contrib.gis.geos.error import GEOSException [as 别名]
def geos_version_info():
    """
    Returns a dictionary containing the various version metadata parsed from
    the GEOS version string, including the version number, whether the version
    is a release candidate (and what number release candidate), and the C API
    version.
    """
    ver = geos_version().decode()
    m = version_regex.match(ver)
    if not m:
        raise GEOSException('Could not parse version info string "%s"' % ver)
    return {key: m.group(key) for key in (
        'version', 'release_candidate', 'capi_version', 'major', 'minor', 'subminor')} 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:15,代码来源:libgeos.py


注:本文中的django.contrib.gis.geos.error.GEOSException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。