Beispiel #1
0
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
}
Beispiel #2
0
// Returns size of related binary representation
func (geom Geometry) WKBSize() int {
	size := C.OGR_G_WkbSize(geom.cval)
	return int(size)
}