Exemplo n.º 1
0
Arquivo: osr.go Projeto: sn-amber/gdal
// Export coordinate system in PCI format
func (sr SpatialReference) ToPCI() (proj, units string, params []float64, errVal error) {
	var p, u *C.char
	err := C.OSRExportToPCI(
		sr.cval, &p, &u, (**C.double)(unsafe.Pointer(&params[0])),
	).Err()
	header := (*reflect.SliceHeader)(unsafe.Pointer(&params))
	header.Cap = 17
	header.Len = 17
	defer C.free(unsafe.Pointer(p))
	defer C.free(unsafe.Pointer(u))
	return C.GoString(p), C.GoString(u), params, err
}
Exemplo n.º 2
0
Arquivo: osr.go Projeto: kikht/gdal
// Export coordinate system in PCI format
func (sr SpatialReference) ToPCI() (proj, units string, params []float64, errVal error) {
	var p, u *C.char
	err := C.OSRExportToPCI(sr.cval, &p, &u, (**C.double)(unsafe.Pointer(&params[0])))
	if err != 0 {
		return "", "", nil, error(err)
	}

	proj = C.GoString(p)
	C.free(unsafe.Pointer(p))

	units = C.GoString(u)
	C.free(unsafe.Pointer(u))

	header := (*reflect.SliceHeader)((unsafe.Pointer(&params)))
	header.Cap = 17
	header.Len = 17

	return proj, units, params, nil
}