本文整理匯總了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)