예제 #1
0
파일: osr.go 프로젝트: 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
}
예제 #2
0
파일: osr.go 프로젝트: 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
}