func (layer *Layer) Wkbs() chan []byte { wkbs := make(chan []byte) go func() { defer close(wkbs) C.OGR_L_ResetReading(layer.v) for { feature := C.OGR_L_GetNextFeature(layer.v) if feature == nil { break } geom := C.OGR_F_GetGeometryRef(feature) size := C.OGR_G_WkbSize(geom) buf := make([]byte, size) C.OGR_G_ExportToWkb(geom, C.wkbNDR, (*C.uchar)(&buf[0])) wkbs <- buf C.OGR_F_Destroy(feature) } }() return wkbs }
func (layer *Layer) Wkts() chan string { wkts := make(chan string) go func() { defer close(wkts) C.OGR_L_ResetReading(layer.v) for { feature := C.OGR_L_GetNextFeature(layer.v) if feature == nil { break } geom := C.OGR_F_GetGeometryRef(feature) var res *C.char C.OGR_G_ExportToWkt(geom, &res) wkts <- C.GoString(res) C.CPLFree(unsafe.Pointer(res)) C.OGR_F_Destroy(feature) } }() return wkts }
// Destroy this feature func (feature Feature) Destroy() { C.OGR_F_Destroy(feature.cval) }