我们从Python开源项目中,提取了以下24个代码示例,用于说明如何使用django.contrib.gis.geos.GeometryCollection()。
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)
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