Example #1
0
func (this *Geos) AsEwkbHex(geom *Geom) []byte {
	writer := C.GEOSWKBWriter_create_r(this.v)
	if writer == nil {
		return nil
	}
	defer C.GEOSWKBWriter_destroy_r(this.v, writer)

	if this.srid != 0 {
		C.GEOSWKBWriter_setIncludeSRID_r(this.v, writer, C.char(1))
		C.GEOSSetSRID_r(this.v, geom.v, C.int(this.srid))
	}

	var size C.size_t
	buf := C.GEOSWKBWriter_writeHEX_r(this.v, writer, geom.v, &size)
	if buf == nil {
		return nil
	}
	result := C.GoBytes(unsafe.Pointer(buf), C.int(size))
	C.free(unsafe.Pointer(buf))
	return result

}
Example #2
0
func cGEOSWKBWriter_writeHEX(writer *C.GEOSWKBWriter, g *C.GEOSGeometry, size *C.size_t) *C.uchar {
	handlemu.Lock()
	defer handlemu.Unlock()
	return C.GEOSWKBWriter_writeHEX_r(handle, writer, g, size)
}