Exemplo n.º 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

}
Exemplo n.º 2
0
func cGEOSSetSRID(g *C.GEOSGeometry, SRID C.int) {
	handlemu.Lock()
	defer handlemu.Unlock()
	C.GEOSSetSRID_r(handle, g, SRID)
}