本文整理汇总了Python中django.contrib.gis.geos.LineString.clone方法的典型用法代码示例。如果您正苦于以下问题:Python LineString.clone方法的具体用法?Python LineString.clone怎么用?Python LineString.clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.contrib.gis.geos.LineString
的用法示例。
在下文中一共展示了LineString.clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _read_geos
# 需要导入模块: from django.contrib.gis.geos import LineString [as 别名]
# 或者: from django.contrib.gis.geos.LineString import clone [as 别名]
def _read_geos(self):
'''
Reads the geometries from the shapefile and dumps them into a string
:returns:the id and geometries of the links in a string
'''
irecord = self.shapefile_reader.iterRecords()
ishapes = self.shapefile_reader.iterShapes()
# read entries into a dictionary which has ids mapped to geometries
id_to_geometry = list()
for i in range(self.shapefile_reader.numRecords):
record = irecord.next()
shape = ishapes.next()
points = [tuple(x) for x in shape.points]
id = int(record[0])
orig_id = int(record[7])
line = LineString(points)
line.set_srid(config.EPSG32611)
defaultprojection = line.clone()
defaultprojection.transform(config.canonical_projection)
googleprojection = line.clone()
googleprojection.transform(config.google_projection)
id_to_geometry.append('\t'.join([str(i), str(id), defaultprojection.ewkt, googleprojection.ewkt, line.ewkt, str(orig_id)]))
return '\n'.join(id_to_geometry)