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


Python geos.GeometryCollection方法代码示例

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


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

示例1: transform_value_for_tile

# 需要导入模块: from django.contrib.gis import geos [as 别名]
# 或者: from django.contrib.gis.geos import GeometryCollection [as 别名]
def transform_value_for_tile(self, value, **kwargs):
        if "format" in kwargs and kwargs["format"] == "esrijson":
            arches_geojson = GeoUtils().arcgisjson_to_geojson(value)
        else:
            arches_geojson = {}
            arches_geojson["type"] = "FeatureCollection"
            arches_geojson["features"] = []
            geometry = GEOSGeometry(value, srid=4326)
            if geometry.geom_type == "GeometryCollection":
                for geom in geometry:
                    arches_json_geometry = {}
                    arches_json_geometry["geometry"] = JSONDeserializer().deserialize(GEOSGeometry(geom, srid=4326).json)
                    arches_json_geometry["type"] = "Feature"
                    arches_json_geometry["id"] = str(uuid.uuid4())
                    arches_json_geometry["properties"] = {}
                    arches_geojson["features"].append(arches_json_geometry)
            else:
                arches_json_geometry = {}
                arches_json_geometry["geometry"] = JSONDeserializer().deserialize(geometry.json)
                arches_json_geometry["type"] = "Feature"
                arches_json_geometry["id"] = str(uuid.uuid4())
                arches_json_geometry["properties"] = {}
                arches_geojson["features"].append(arches_json_geometry)

        return arches_geojson 
开发者ID:archesproject,项目名称:arches,代码行数:27,代码来源:datatypes.py

示例2: _set_geom

# 需要导入模块: from django.contrib.gis import geos [as 别名]
# 或者: from django.contrib.gis.geos import GeometryCollection [as 别名]
def _set_geom(self):
        xform = self.xform
        data_dictionary = xform.data_dictionary()
        geo_xpaths = data_dictionary.geopoint_xpaths()
        doc = self.get_dict()
        points = []

        if len(geo_xpaths):
            for xpath in geo_xpaths:
                geometry = [float(s) for s in doc.get(xpath, u'').split()]

                if len(geometry):
                    lat, lng = geometry[0:2]
                    points.append(Point(lng, lat))

            if not xform.instances_with_geopoints and len(points):
                xform.instances_with_geopoints = True
                xform.save()

            self.geom = GeometryCollection(points) 
开发者ID:awemulya,项目名称:kobo-predict,代码行数:22,代码来源:instance.py

示例3: get_geometry_fieldnames

# 需要导入模块: from django.contrib.gis import geos [as 别名]
# 或者: from django.contrib.gis.geos import GeometryCollection [as 别名]
def get_geometry_fieldnames(self, instance):
        """
        Finds GeometryCollection field in a flattened resource intance to use as the geometry of each shapefile record.
        """
        geometry_fields = []
        for k, v in instance.items():
            if isinstance(v, GeometryCollection):
                geometry_fields.append(k)
        return geometry_fields 
开发者ID:archesproject,项目名称:arches,代码行数:11,代码来源:shpfile.py

示例4: create_geom_collection_from_geojson

# 需要导入模块: from django.contrib.gis import geos [as 别名]
# 或者: from django.contrib.gis.geos import GeometryCollection [as 别名]
def create_geom_collection_from_geojson(self, geojson):
        geoms = []
        for feature in geojson["features"]:
            geoms.append(GEOSGeometry(JSONSerializer().serialize(feature["geometry"])))
        return GeometryCollection(geoms) 
开发者ID:archesproject,项目名称:arches,代码行数:7,代码来源:geo_utils.py

示例5: transform_export_values

# 需要导入模块: from django.contrib.gis import geos [as 别名]
# 或者: from django.contrib.gis.geos import GeometryCollection [as 别名]
def transform_export_values(self, value, *args, **kwargs):
        wkt_geoms = []
        for feature in value["features"]:
            wkt_geoms.append(GEOSGeometry(json.dumps(feature["geometry"])))
        return GeometryCollection(wkt_geoms) 
开发者ID:archesproject,项目名称:arches,代码行数:7,代码来源:datatypes.py

示例6: geometry

# 需要导入模块: from django.contrib.gis import geos [as 别名]
# 或者: from django.contrib.gis.geos import GeometryCollection [as 别名]
def geometry(feat):
    """Constructs a GEOSGeometryCollection from a GeoJSON dict.
    """
    return GeometryCollection(_geometry(feat), srid=4326) 
开发者ID:codeforboston,项目名称:cornerwise,代码行数:6,代码来源:utils.py

示例7: __init__

# 需要导入模块: from django.contrib.gis import geos [as 别名]
# 或者: from django.contrib.gis.geos import GeometryCollection [as 别名]
def __init__(self, geom):
        """
        Oracle requires that polygon rings are in proper orientation. This
        affects spatial operations and an invalid orientation may cause
        failures. Correct orientations are:
         * Outer ring - counter clockwise
         * Inner ring(s) - clockwise
        """
        if isinstance(geom, Polygon):
            self._fix_polygon(geom)
        elif isinstance(geom, GeometryCollection):
            self._fix_geometry_collection(geom)

        self.wkt = geom.wkt
        self.srid = geom.srid 
开发者ID:drexly,项目名称:openhgsenti,代码行数:17,代码来源:adapter.py


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