def read_line(self): sf = shapefile.Reader(self.from_file) for record in sf.shapeRecords(): if record.shape.shapeType == self.shape_type: attributes = record.record poly = Polyline(record.shape.points, attributes) self.shapes.append(poly)
def from_i3s_to_i2s(self, new_shapes, to_file): attributes = [] shapes = [] for line in new_shapes: attributes.append(line.attributes()[0]) coords = np.array(list(line.coords())) shapes.append(Polyline(coords[:, :2])) with bk.Write(to_file) as f: f.write_header(self.default_header) f.write_lines(shapes, attributes)
def read_linez(self): sf = shapefile.Reader(self.from_file) for record in sf.shapeRecords(): if record.shape.shapeType == self.shape_type: attributes = record.record if hasattr(record.shape, 'm'): m_array = record.shape.m else: m_array = None poly = Polyline(record.shape.points, attributes, z_array=record.shape.z, m_array=m_array) self.shapes.append(poly)