예제 #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

}
예제 #2
0
파일: cwrappers.go 프로젝트: helmi03/gogeos
func cGEOSWKBWriter_destroy(writer *C.GEOSWKBWriter) {
	handlemu.Lock()
	defer handlemu.Unlock()
	C.GEOSWKBWriter_destroy_r(handle, writer)
}