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)
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)