2854
2892
typedef void OSRCoordinateTransformationShadow;
2857
typedef char retStringAndCPLFree;
2861
2896
int bUseExceptions=0;
2897
CPLErrorHandler pfnPreviousHandler = CPLDefaultErrorHandler;
2863
2899
void CPL_STDCALL
2864
VeryQuietErrorHandler(CPLErr eclass, int code, const char *msg )
2900
PythonBindingErrorHandler(CPLErr eclass, int code, const char *msg )
2903
** Generally we want to supress error reporting if we have exceptions
2904
** enabled as the error message will be in the exception thrown in
2866
2908
/* If the error class is CE_Fatal, we want to have a message issued
2867
2909
because the CPL support code does an abort() before any exception
2868
2910
can be generated */
2869
2911
if (eclass == CE_Fatal ) {
2870
CPLDefaultErrorHandler(eclass, code, msg );
2912
pfnPreviousHandler(eclass, code, msg );
2916
** We do not want to interfere with warnings or debug messages since
2917
** they won't be translated into exceptions.
2919
if (eclass == CE_Warning || eclass == CE_Debug ) {
2920
pfnPreviousHandler(eclass, code, msg );
2926
int GetUseExceptions() {
2927
return bUseExceptions;
2875
2930
void UseExceptions() {
2876
2931
bUseExceptions = 1;
2877
CPLSetErrorHandler( (CPLErrorHandler) VeryQuietErrorHandler );
2932
pfnPreviousHandler =
2933
CPLSetErrorHandler( (CPLErrorHandler) PythonBindingErrorHandler );
2880
2936
void DontUseExceptions() {
2881
2937
bUseExceptions = 0;
2882
CPLSetErrorHandler( CPLDefaultErrorHandler );
2938
CPLSetErrorHandler( pfnPreviousHandler );
2942
#define SWIG_From_long PyInt_FromLong
2945
SWIGINTERNINLINE PyObject *
2946
SWIG_From_int (int value)
2948
return SWIG_From_long (value);
2904
2979
/* Return a NULL terminated c String from a PyObject */
2905
2980
/* Result must be freed with GDALPythonFreeCStr */
2906
static char* GDALPythonObjectToCStr(PyObject* pyObject)
2981
static char* GDALPythonObjectToCStr(PyObject* pyObject, int* pbToFree)
2908
#if PY_VERSION_HEX >= 0x03000000
2909
2984
if (PyUnicode_Check(pyObject))
2912
2987
char *pszNewStr;
2914
2989
PyObject* pyUTF8Str = PyUnicode_AsUTF8String(pyObject);
2990
#if PY_VERSION_HEX >= 0x03000000
2915
2991
PyBytes_AsStringAndSize(pyUTF8Str, &pszStr, &nLen);
2993
PyString_AsStringAndSize(pyUTF8Str, &pszStr, &nLen);
2916
2995
pszNewStr = (char *) malloc(nLen+1);
2917
2996
memcpy(pszNewStr, pszStr, nLen+1);
2918
2997
Py_XDECREF(pyUTF8Str);
2921
else if (PyBytes_Check(pyObject))
2926
PyBytes_AsStringAndSize(pyObject, &pszStr, &nLen);
2927
pszNewStr = (char *) malloc(nLen+1);
2928
memcpy(pszNewStr, pszStr, nLen+1);
2933
char *pszStr = (char *) malloc(1);
2938
return PyString_AsString(pyObject);
2942
3003
#if PY_VERSION_HEX >= 0x03000000
2943
#define GDALPythonFreeCStr(x) free( (void*) (x) )
3004
return PyBytes_AsString(pyObject);
2945
#define GDALPythonFreeCStr(x)
3006
return PyString_AsString(pyObject);
3011
static void GDALPythonFreeCStr(void* ptr, int bToFree)
3153
3222
SWIGINTERN int OSRSpatialReferenceShadow_IsSame(OSRSpatialReferenceShadow *self,OSRSpatialReferenceShadow *rhs){
3154
3223
return OSRIsSame( self, rhs );
3157
#define SWIG_From_long PyInt_FromLong
3160
SWIGINTERNINLINE PyObject *
3161
SWIG_From_int (int value)
3163
return SWIG_From_long (value);
3166
3225
SWIGINTERN int OSRSpatialReferenceShadow_IsSameGeogCS(OSRSpatialReferenceShadow *self,OSRSpatialReferenceShadow *rhs){
3167
3226
return OSRIsSameGeogCS( self, rhs );
3228
SWIGINTERN int OSRSpatialReferenceShadow_IsSameVertCS(OSRSpatialReferenceShadow *self,OSRSpatialReferenceShadow *rhs){
3229
return OSRIsSameVertCS( self, rhs );
3169
3231
SWIGINTERN int OSRSpatialReferenceShadow_IsGeographic(OSRSpatialReferenceShadow *self){
3170
3232
return OSRIsGeographic(self);
3172
3234
SWIGINTERN int OSRSpatialReferenceShadow_IsProjected(OSRSpatialReferenceShadow *self){
3173
3235
return OSRIsProjected(self);
3237
SWIGINTERN int OSRSpatialReferenceShadow_IsCompound(OSRSpatialReferenceShadow *self){
3238
return OSRIsCompound(self);
3240
SWIGINTERN int OSRSpatialReferenceShadow_IsGeocentric(OSRSpatialReferenceShadow *self){
3241
return OSRIsGeocentric(self);
3175
3243
SWIGINTERN int OSRSpatialReferenceShadow_IsLocal(OSRSpatialReferenceShadow *self){
3176
3244
return OSRIsLocal(self);
3246
SWIGINTERN int OSRSpatialReferenceShadow_IsVertical(OSRSpatialReferenceShadow *self){
3247
return OSRIsVertical(self);
3178
3249
SWIGINTERN int OSRSpatialReferenceShadow_EPSGTreatsAsLatLong(OSRSpatialReferenceShadow *self){
3179
3250
return OSREPSGTreatsAsLatLong(self);
4288
SWIGINTERN PyObject *_wrap_SpatialReference_IsSameVertCS(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4289
PyObject *resultobj = 0;
4290
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
4291
OSRSpatialReferenceShadow *arg2 = (OSRSpatialReferenceShadow *) 0 ;
4296
PyObject * obj0 = 0 ;
4297
PyObject * obj1 = 0 ;
4300
if (!PyArg_ParseTuple(args,(char *)"OO:SpatialReference_IsSameVertCS",&obj0,&obj1)) SWIG_fail;
4301
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 | 0 );
4302
if (!SWIG_IsOK(res1)) {
4303
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_IsSameVertCS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'");
4305
arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
4306
res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 | 0 );
4307
if (!SWIG_IsOK(res2)) {
4308
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_IsSameVertCS" "', argument " "2"" of type '" "OSRSpatialReferenceShadow *""'");
4310
arg2 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp2);
4313
SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
4317
if ( bUseExceptions ) {
4320
result = (int)OSRSpatialReferenceShadow_IsSameVertCS(arg1,arg2);
4321
if ( bUseExceptions ) {
4322
CPLErr eclass = CPLGetLastErrorType();
4323
if ( eclass == CE_Failure || eclass == CE_Fatal ) {
4324
SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
4328
resultobj = SWIG_From_int(static_cast< int >(result));
4138
4335
SWIGINTERN PyObject *_wrap_SpatialReference_IsGeographic(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4139
4336
PyObject *resultobj = 0;
4140
4337
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
4401
SWIGINTERN PyObject *_wrap_SpatialReference_IsCompound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4402
PyObject *resultobj = 0;
4403
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
4406
PyObject * obj0 = 0 ;
4409
if (!PyArg_ParseTuple(args,(char *)"O:SpatialReference_IsCompound",&obj0)) SWIG_fail;
4410
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 | 0 );
4411
if (!SWIG_IsOK(res1)) {
4412
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_IsCompound" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'");
4414
arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
4416
if ( bUseExceptions ) {
4419
result = (int)OSRSpatialReferenceShadow_IsCompound(arg1);
4420
if ( bUseExceptions ) {
4421
CPLErr eclass = CPLGetLastErrorType();
4422
if ( eclass == CE_Failure || eclass == CE_Fatal ) {
4423
SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
4427
resultobj = SWIG_From_int(static_cast< int >(result));
4434
SWIGINTERN PyObject *_wrap_SpatialReference_IsGeocentric(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4435
PyObject *resultobj = 0;
4436
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
4439
PyObject * obj0 = 0 ;
4442
if (!PyArg_ParseTuple(args,(char *)"O:SpatialReference_IsGeocentric",&obj0)) SWIG_fail;
4443
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 | 0 );
4444
if (!SWIG_IsOK(res1)) {
4445
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_IsGeocentric" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'");
4447
arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
4449
if ( bUseExceptions ) {
4452
result = (int)OSRSpatialReferenceShadow_IsGeocentric(arg1);
4453
if ( bUseExceptions ) {
4454
CPLErr eclass = CPLGetLastErrorType();
4455
if ( eclass == CE_Failure || eclass == CE_Fatal ) {
4456
SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
4460
resultobj = SWIG_From_int(static_cast< int >(result));
4198
4467
SWIGINTERN PyObject *_wrap_SpatialReference_IsLocal(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4199
4468
PyObject *resultobj = 0;
4200
4469
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
4895
SWIGINTERN PyObject *_wrap_SpatialReference_SetTargetLinearUnits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4896
PyObject *resultobj = 0;
4897
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
4898
char *arg2 = (char *) 0 ;
4899
char *arg3 = (char *) 0 ;
4911
PyObject * obj0 = 0 ;
4912
PyObject * obj1 = 0 ;
4913
PyObject * obj2 = 0 ;
4914
PyObject * obj3 = 0 ;
4917
if (!PyArg_ParseTuple(args,(char *)"OOOO:SpatialReference_SetTargetLinearUnits",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
4918
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 | 0 );
4919
if (!SWIG_IsOK(res1)) {
4920
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetTargetLinearUnits" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'");
4922
arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
4923
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
4924
if (!SWIG_IsOK(res2)) {
4925
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_SetTargetLinearUnits" "', argument " "2"" of type '" "char const *""'");
4927
arg2 = reinterpret_cast< char * >(buf2);
4928
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
4929
if (!SWIG_IsOK(res3)) {
4930
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialReference_SetTargetLinearUnits" "', argument " "3"" of type '" "char const *""'");
4932
arg3 = reinterpret_cast< char * >(buf3);
4933
ecode4 = SWIG_AsVal_double(obj3, &val4);
4934
if (!SWIG_IsOK(ecode4)) {
4935
SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetTargetLinearUnits" "', argument " "4"" of type '" "double""'");
4937
arg4 = static_cast< double >(val4);
4940
SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
4944
if ( bUseExceptions ) {
4947
result = (OGRErr)OSRSpatialReferenceShadow_SetTargetLinearUnits(arg1,(char const *)arg2,(char const *)arg3,arg4);
4948
if ( bUseExceptions ) {
4949
CPLErr eclass = CPLGetLastErrorType();
4950
if ( eclass == CE_Failure || eclass == CE_Fatal ) {
4951
SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
4956
/* %typemap(out) OGRErr */
4957
if ( result != 0 && bUseExceptions) {
4958
PyErr_SetString( PyExc_RuntimeError, OGRErrMessages(result) );
4962
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
4963
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
4965
/* %typemap(ret) OGRErr */
4966
if (resultobj == Py_None ) {
4967
Py_DECREF(resultobj);
4970
if (resultobj == 0) {
4971
resultobj = PyInt_FromLong( result );
4976
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
4977
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
4572
4982
SWIGINTERN PyObject *_wrap_SpatialReference_SetLinearUnits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4573
4983
PyObject *resultobj = 0;
4574
4984
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
5866
SWIGINTERN PyObject *_wrap_SpatialReference_GetSemiMajor(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
5867
PyObject *resultobj = 0;
5868
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
5871
PyObject * obj0 = 0 ;
5874
if (!PyArg_ParseTuple(args,(char *)"O:SpatialReference_GetSemiMajor",&obj0)) SWIG_fail;
5875
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 | 0 );
5876
if (!SWIG_IsOK(res1)) {
5877
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetSemiMajor" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'");
5879
arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
5881
if ( bUseExceptions ) {
5884
result = (double)OSRSpatialReferenceShadow_GetSemiMajor(arg1);
5885
if ( bUseExceptions ) {
5886
CPLErr eclass = CPLGetLastErrorType();
5887
if ( eclass == CE_Failure || eclass == CE_Fatal ) {
5888
SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
5892
resultobj = SWIG_From_double(static_cast< double >(result));
5899
SWIGINTERN PyObject *_wrap_SpatialReference_GetSemiMinor(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
5900
PyObject *resultobj = 0;
5901
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
5904
PyObject * obj0 = 0 ;
5907
if (!PyArg_ParseTuple(args,(char *)"O:SpatialReference_GetSemiMinor",&obj0)) SWIG_fail;
5908
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 | 0 );
5909
if (!SWIG_IsOK(res1)) {
5910
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetSemiMinor" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'");
5912
arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
5914
if ( bUseExceptions ) {
5917
result = (double)OSRSpatialReferenceShadow_GetSemiMinor(arg1);
5918
if ( bUseExceptions ) {
5919
CPLErr eclass = CPLGetLastErrorType();
5920
if ( eclass == CE_Failure || eclass == CE_Fatal ) {
5921
SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
5925
resultobj = SWIG_From_double(static_cast< double >(result));
5932
SWIGINTERN PyObject *_wrap_SpatialReference_GetInvFlattening(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
5933
PyObject *resultobj = 0;
5934
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
5937
PyObject * obj0 = 0 ;
5940
if (!PyArg_ParseTuple(args,(char *)"O:SpatialReference_GetInvFlattening",&obj0)) SWIG_fail;
5941
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 | 0 );
5942
if (!SWIG_IsOK(res1)) {
5943
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetInvFlattening" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'");
5945
arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
5947
if ( bUseExceptions ) {
5950
result = (double)OSRSpatialReferenceShadow_GetInvFlattening(arg1);
5951
if ( bUseExceptions ) {
5952
CPLErr eclass = CPLGetLastErrorType();
5953
if ( eclass == CE_Failure || eclass == CE_Fatal ) {
5954
SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
5958
resultobj = SWIG_From_double(static_cast< double >(result));
5381
5965
SWIGINTERN PyObject *_wrap_SpatialReference_SetACEA(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
5382
5966
PyObject *resultobj = 0;
5383
5967
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
7127
SWIGINTERN PyObject *_wrap_SpatialReference_SetIGH(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
7128
PyObject *resultobj = 0;
7129
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
7132
PyObject * obj0 = 0 ;
7135
if (!PyArg_ParseTuple(args,(char *)"O:SpatialReference_SetIGH",&obj0)) SWIG_fail;
7136
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 | 0 );
7137
if (!SWIG_IsOK(res1)) {
7138
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetIGH" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'");
7140
arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
7142
if ( bUseExceptions ) {
7145
result = (OGRErr)OSRSpatialReferenceShadow_SetIGH(arg1);
7146
if ( bUseExceptions ) {
7147
CPLErr eclass = CPLGetLastErrorType();
7148
if ( eclass == CE_Failure || eclass == CE_Fatal ) {
7149
SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
7154
/* %typemap(out) OGRErr */
7155
if ( result != 0 && bUseExceptions) {
7156
PyErr_SetString( PyExc_RuntimeError, OGRErrMessages(result) );
7161
/* %typemap(ret) OGRErr */
7162
if (resultobj == Py_None ) {
7163
Py_DECREF(resultobj);
7166
if (resultobj == 0) {
7167
resultobj = PyInt_FromLong( result );
6504
7176
SWIGINTERN PyObject *_wrap_SpatialReference_SetGEOS(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
6505
7177
PyObject *resultobj = 0;
6506
7178
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
10295
SWIGINTERN PyObject *_wrap_SpatialReference_SetGeocCS(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
10296
PyObject *resultobj = 0;
10297
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
10298
char *arg2 = (char *) "unnamed" ;
10304
PyObject * obj0 = 0 ;
10305
PyObject * obj1 = 0 ;
10308
if (!PyArg_ParseTuple(args,(char *)"O|O:SpatialReference_SetGeocCS",&obj0,&obj1)) SWIG_fail;
10309
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 | 0 );
10310
if (!SWIG_IsOK(res1)) {
10311
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetGeocCS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'");
10313
arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
10315
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
10316
if (!SWIG_IsOK(res2)) {
10317
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_SetGeocCS" "', argument " "2"" of type '" "char const *""'");
10319
arg2 = reinterpret_cast< char * >(buf2);
10323
SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
10327
if ( bUseExceptions ) {
10330
result = (OGRErr)OSRSpatialReferenceShadow_SetGeocCS(arg1,(char const *)arg2);
10331
if ( bUseExceptions ) {
10332
CPLErr eclass = CPLGetLastErrorType();
10333
if ( eclass == CE_Failure || eclass == CE_Fatal ) {
10334
SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
10339
/* %typemap(out) OGRErr */
10340
if ( result != 0 && bUseExceptions) {
10341
PyErr_SetString( PyExc_RuntimeError, OGRErrMessages(result) );
10345
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
10347
/* %typemap(ret) OGRErr */
10348
if (resultobj == Py_None ) {
10349
Py_DECREF(resultobj);
10352
if (resultobj == 0) {
10353
resultobj = PyInt_FromLong( result );
10358
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
10363
SWIGINTERN PyObject *_wrap_SpatialReference_SetVertCS(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
10364
PyObject *resultobj = 0;
10365
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
10366
char *arg2 = (char *) "unnamed" ;
10367
char *arg3 = (char *) "unnamed" ;
10368
int arg4 = (int) 0 ;
10379
PyObject * obj0 = 0 ;
10380
PyObject * obj1 = 0 ;
10381
PyObject * obj2 = 0 ;
10382
PyObject * obj3 = 0 ;
10385
if (!PyArg_ParseTuple(args,(char *)"O|OOO:SpatialReference_SetVertCS",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
10386
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 | 0 );
10387
if (!SWIG_IsOK(res1)) {
10388
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetVertCS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'");
10390
arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
10392
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
10393
if (!SWIG_IsOK(res2)) {
10394
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_SetVertCS" "', argument " "2"" of type '" "char const *""'");
10396
arg2 = reinterpret_cast< char * >(buf2);
10399
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
10400
if (!SWIG_IsOK(res3)) {
10401
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialReference_SetVertCS" "', argument " "3"" of type '" "char const *""'");
10403
arg3 = reinterpret_cast< char * >(buf3);
10406
ecode4 = SWIG_AsVal_int(obj3, &val4);
10407
if (!SWIG_IsOK(ecode4)) {
10408
SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetVertCS" "', argument " "4"" of type '" "int""'");
10410
arg4 = static_cast< int >(val4);
10413
if ( bUseExceptions ) {
10416
result = (OGRErr)OSRSpatialReferenceShadow_SetVertCS(arg1,(char const *)arg2,(char const *)arg3,arg4);
10417
if ( bUseExceptions ) {
10418
CPLErr eclass = CPLGetLastErrorType();
10419
if ( eclass == CE_Failure || eclass == CE_Fatal ) {
10420
SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
10425
/* %typemap(out) OGRErr */
10426
if ( result != 0 && bUseExceptions) {
10427
PyErr_SetString( PyExc_RuntimeError, OGRErrMessages(result) );
10431
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
10432
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
10434
/* %typemap(ret) OGRErr */
10435
if (resultobj == Py_None ) {
10436
Py_DECREF(resultobj);
10439
if (resultobj == 0) {
10440
resultobj = PyInt_FromLong( result );
10445
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
10446
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
10451
SWIGINTERN PyObject *_wrap_SpatialReference_SetCompoundCS(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
10452
PyObject *resultobj = 0;
10453
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
10454
char *arg2 = (char *) 0 ;
10455
OSRSpatialReferenceShadow *arg3 = (OSRSpatialReferenceShadow *) 0 ;
10456
OSRSpatialReferenceShadow *arg4 = (OSRSpatialReferenceShadow *) 0 ;
10466
PyObject * obj0 = 0 ;
10467
PyObject * obj1 = 0 ;
10468
PyObject * obj2 = 0 ;
10469
PyObject * obj3 = 0 ;
10472
if (!PyArg_ParseTuple(args,(char *)"OOOO:SpatialReference_SetCompoundCS",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
10473
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 | 0 );
10474
if (!SWIG_IsOK(res1)) {
10475
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetCompoundCS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'");
10477
arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
10478
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
10479
if (!SWIG_IsOK(res2)) {
10480
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_SetCompoundCS" "', argument " "2"" of type '" "char const *""'");
10482
arg2 = reinterpret_cast< char * >(buf2);
10483
res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 | 0 );
10484
if (!SWIG_IsOK(res3)) {
10485
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialReference_SetCompoundCS" "', argument " "3"" of type '" "OSRSpatialReferenceShadow *""'");
10487
arg3 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp3);
10488
res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 | 0 );
10489
if (!SWIG_IsOK(res4)) {
10490
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "SpatialReference_SetCompoundCS" "', argument " "4"" of type '" "OSRSpatialReferenceShadow *""'");
10492
arg4 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp4);
10495
SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
10500
SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
10505
SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
10509
if ( bUseExceptions ) {
10512
result = (OGRErr)OSRSpatialReferenceShadow_SetCompoundCS(arg1,(char const *)arg2,arg3,arg4);
10513
if ( bUseExceptions ) {
10514
CPLErr eclass = CPLGetLastErrorType();
10515
if ( eclass == CE_Failure || eclass == CE_Fatal ) {
10516
SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
10521
/* %typemap(out) OGRErr */
10522
if ( result != 0 && bUseExceptions) {
10523
PyErr_SetString( PyExc_RuntimeError, OGRErrMessages(result) );
10527
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
10529
/* %typemap(ret) OGRErr */
10530
if (resultobj == Py_None ) {
10531
Py_DECREF(resultobj);
10534
if (resultobj == 0) {
10535
resultobj = PyInt_FromLong( result );
10540
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
9521
10545
SWIGINTERN PyObject *_wrap_SpatialReference_ImportFromWkt(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
9522
10546
PyObject *resultobj = 0;
9523
10547
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
9715
10753
int size = PySequence_Size(obj1);
9716
10754
for (int i = 0; i < size; i++) {
9717
char *pszItem = NULL;
9718
10755
PyObject* pyObj = PySequence_GetItem(obj1,i);
9719
if ( ! PyArg_Parse( pyObj, "s", &pszItem ) ) {
10756
if (PyUnicode_Check(pyObj))
10760
PyObject* pyUTF8Str = PyUnicode_AsUTF8String(pyObj);
10761
#if PY_VERSION_HEX >= 0x03000000
10762
PyBytes_AsStringAndSize(pyUTF8Str, &pszStr, &nLen);
10764
PyString_AsStringAndSize(pyUTF8Str, &pszStr, &nLen);
10766
arg2 = CSLAddString( arg2, pszStr );
10767
Py_XDECREF(pyUTF8Str);
10769
#if PY_VERSION_HEX >= 0x03000000
10770
else if (PyBytes_Check(pyObj))
10771
arg2 = CSLAddString( arg2, PyBytes_AsString(pyObj) );
10773
else if (PyString_Check(pyObj))
10774
arg2 = CSLAddString( arg2, PyString_AsString(pyObj) );
9720
10778
Py_DECREF(pyObj);
9721
10779
PyErr_SetString(PyExc_TypeError,"sequence must contain strings");
9724
arg2 = CSLAddString( arg2, pszItem );
9725
10782
Py_DECREF(pyObj);
10786
if ( bUseExceptions ) {
9729
10789
result = (OGRErr)OSRSpatialReferenceShadow_ImportFromESRI(arg1,arg2);
9730
10790
if ( bUseExceptions ) {
9731
10791
CPLErr eclass = CPLGetLastErrorType();
11218
SWIGINTERN PyObject *_wrap_SpatialReference_ImportFromERM(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
11219
PyObject *resultobj = 0;
11220
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
11221
char *arg2 = (char *) 0 ;
11222
char *arg3 = (char *) 0 ;
11223
char *arg4 = (char *) 0 ;
11235
PyObject * obj0 = 0 ;
11236
PyObject * obj1 = 0 ;
11237
PyObject * obj2 = 0 ;
11238
PyObject * obj3 = 0 ;
11241
if (!PyArg_ParseTuple(args,(char *)"OOOO:SpatialReference_ImportFromERM",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
11242
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 | 0 );
11243
if (!SWIG_IsOK(res1)) {
11244
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ImportFromERM" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'");
11246
arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
11247
res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
11248
if (!SWIG_IsOK(res2)) {
11249
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_ImportFromERM" "', argument " "2"" of type '" "char const *""'");
11251
arg2 = reinterpret_cast< char * >(buf2);
11252
res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
11253
if (!SWIG_IsOK(res3)) {
11254
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialReference_ImportFromERM" "', argument " "3"" of type '" "char const *""'");
11256
arg3 = reinterpret_cast< char * >(buf3);
11257
res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
11258
if (!SWIG_IsOK(res4)) {
11259
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "SpatialReference_ImportFromERM" "', argument " "4"" of type '" "char const *""'");
11261
arg4 = reinterpret_cast< char * >(buf4);
11264
SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
11269
SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
11273
if ( bUseExceptions ) {
11276
result = (OGRErr)OSRSpatialReferenceShadow_ImportFromERM(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
11277
if ( bUseExceptions ) {
11278
CPLErr eclass = CPLGetLastErrorType();
11279
if ( eclass == CE_Failure || eclass == CE_Fatal ) {
11280
SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
11285
/* %typemap(out) OGRErr */
11286
if ( result != 0 && bUseExceptions) {
11287
PyErr_SetString( PyExc_RuntimeError, OGRErrMessages(result) );
11291
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
11292
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
11293
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
11295
/* %typemap(ret) OGRErr */
11296
if (resultobj == Py_None ) {
11297
Py_DECREF(resultobj);
11300
if (resultobj == 0) {
11301
resultobj = PyInt_FromLong( result );
11306
if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
11307
if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
11308
if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
10143
11313
SWIGINTERN PyObject *_wrap_SpatialReference_ImportFromMICoordSys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
10144
11314
PyObject *resultobj = 0;
10145
11315
OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
11513
12747
{ (char *)"SpatialReference___str__", _wrap_SpatialReference___str__, METH_VARARGS, (char *)"SpatialReference___str__(SpatialReference self) -> retStringAndCPLFree"},
11514
12748
{ (char *)"SpatialReference_IsSame", _wrap_SpatialReference_IsSame, METH_VARARGS, (char *)"SpatialReference_IsSame(SpatialReference self, SpatialReference rhs) -> int"},
11515
12749
{ (char *)"SpatialReference_IsSameGeogCS", _wrap_SpatialReference_IsSameGeogCS, METH_VARARGS, (char *)"SpatialReference_IsSameGeogCS(SpatialReference self, SpatialReference rhs) -> int"},
12750
{ (char *)"SpatialReference_IsSameVertCS", _wrap_SpatialReference_IsSameVertCS, METH_VARARGS, (char *)"SpatialReference_IsSameVertCS(SpatialReference self, SpatialReference rhs) -> int"},
11516
12751
{ (char *)"SpatialReference_IsGeographic", _wrap_SpatialReference_IsGeographic, METH_VARARGS, (char *)"SpatialReference_IsGeographic(SpatialReference self) -> int"},
11517
12752
{ (char *)"SpatialReference_IsProjected", _wrap_SpatialReference_IsProjected, METH_VARARGS, (char *)"SpatialReference_IsProjected(SpatialReference self) -> int"},
12753
{ (char *)"SpatialReference_IsCompound", _wrap_SpatialReference_IsCompound, METH_VARARGS, (char *)"SpatialReference_IsCompound(SpatialReference self) -> int"},
12754
{ (char *)"SpatialReference_IsGeocentric", _wrap_SpatialReference_IsGeocentric, METH_VARARGS, (char *)"SpatialReference_IsGeocentric(SpatialReference self) -> int"},
11518
12755
{ (char *)"SpatialReference_IsLocal", _wrap_SpatialReference_IsLocal, METH_VARARGS, (char *)"SpatialReference_IsLocal(SpatialReference self) -> int"},
12756
{ (char *)"SpatialReference_IsVertical", _wrap_SpatialReference_IsVertical, METH_VARARGS, (char *)"SpatialReference_IsVertical(SpatialReference self) -> int"},
11519
12757
{ (char *)"SpatialReference_EPSGTreatsAsLatLong", _wrap_SpatialReference_EPSGTreatsAsLatLong, METH_VARARGS, (char *)"SpatialReference_EPSGTreatsAsLatLong(SpatialReference self) -> int"},
11520
12758
{ (char *)"SpatialReference_SetAuthority", _wrap_SpatialReference_SetAuthority, METH_VARARGS, (char *)"\n"
11521
12759
"SpatialReference_SetAuthority(SpatialReference self, char pszTargetKey, char pszAuthority, \n"
11525
12763
{ (char *)"SpatialReference_SetAttrValue", _wrap_SpatialReference_SetAttrValue, METH_VARARGS, (char *)"SpatialReference_SetAttrValue(SpatialReference self, char name, char value) -> OGRErr"},
11526
12764
{ (char *)"SpatialReference_SetAngularUnits", _wrap_SpatialReference_SetAngularUnits, METH_VARARGS, (char *)"SpatialReference_SetAngularUnits(SpatialReference self, char name, double to_radians) -> OGRErr"},
11527
12765
{ (char *)"SpatialReference_GetAngularUnits", _wrap_SpatialReference_GetAngularUnits, METH_VARARGS, (char *)"SpatialReference_GetAngularUnits(SpatialReference self) -> double"},
12766
{ (char *)"SpatialReference_SetTargetLinearUnits", _wrap_SpatialReference_SetTargetLinearUnits, METH_VARARGS, (char *)"SpatialReference_SetTargetLinearUnits(SpatialReference self, char target, char name, double to_meters) -> OGRErr"},
11528
12767
{ (char *)"SpatialReference_SetLinearUnits", _wrap_SpatialReference_SetLinearUnits, METH_VARARGS, (char *)"SpatialReference_SetLinearUnits(SpatialReference self, char name, double to_meters) -> OGRErr"},
11529
12768
{ (char *)"SpatialReference_SetLinearUnitsAndUpdateParameters", _wrap_SpatialReference_SetLinearUnitsAndUpdateParameters, METH_VARARGS, (char *)"SpatialReference_SetLinearUnitsAndUpdateParameters(SpatialReference self, char name, double to_meters) -> OGRErr"},
11530
12769
{ (char *)"SpatialReference_GetLinearUnits", _wrap_SpatialReference_GetLinearUnits, METH_VARARGS, (char *)"SpatialReference_GetLinearUnits(SpatialReference self) -> double"},
11542
12782
{ (char *)"SpatialReference_GetProjParm", _wrap_SpatialReference_GetProjParm, METH_VARARGS, (char *)"SpatialReference_GetProjParm(SpatialReference self, char name, double default_val = 0.0) -> double"},
11543
12783
{ (char *)"SpatialReference_SetNormProjParm", _wrap_SpatialReference_SetNormProjParm, METH_VARARGS, (char *)"SpatialReference_SetNormProjParm(SpatialReference self, char name, double val) -> OGRErr"},
11544
12784
{ (char *)"SpatialReference_GetNormProjParm", _wrap_SpatialReference_GetNormProjParm, METH_VARARGS, (char *)"SpatialReference_GetNormProjParm(SpatialReference self, char name, double default_val = 0.0) -> double"},
12785
{ (char *)"SpatialReference_GetSemiMajor", _wrap_SpatialReference_GetSemiMajor, METH_VARARGS, (char *)"SpatialReference_GetSemiMajor(SpatialReference self) -> double"},
12786
{ (char *)"SpatialReference_GetSemiMinor", _wrap_SpatialReference_GetSemiMinor, METH_VARARGS, (char *)"SpatialReference_GetSemiMinor(SpatialReference self) -> double"},
12787
{ (char *)"SpatialReference_GetInvFlattening", _wrap_SpatialReference_GetInvFlattening, METH_VARARGS, (char *)"SpatialReference_GetInvFlattening(SpatialReference self) -> double"},
11545
12788
{ (char *)"SpatialReference_SetACEA", (PyCFunction) _wrap_SpatialReference_SetACEA, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
11546
12789
"SpatialReference_SetACEA(SpatialReference self, double stdp1, double stdp2, \n"
11547
12790
" double clat, double clong, double fe, double fn) -> OGRErr\n"
11696
12940
" double dfConvertToRadians = 0.0174532925199433) -> OGRErr\n"
11698
12942
{ (char *)"SpatialReference_SetProjCS", _wrap_SpatialReference_SetProjCS, METH_VARARGS, (char *)"SpatialReference_SetProjCS(SpatialReference self, char name = \"unnamed\") -> OGRErr"},
12943
{ (char *)"SpatialReference_SetGeocCS", _wrap_SpatialReference_SetGeocCS, METH_VARARGS, (char *)"SpatialReference_SetGeocCS(SpatialReference self, char name = \"unnamed\") -> OGRErr"},
12944
{ (char *)"SpatialReference_SetVertCS", _wrap_SpatialReference_SetVertCS, METH_VARARGS, (char *)"\n"
12945
"SpatialReference_SetVertCS(SpatialReference self, char VertCSName = \"unnamed\", \n"
12946
" char VertDatumName = \"unnamed\", int VertDatumType = 0) -> OGRErr\n"
12948
{ (char *)"SpatialReference_SetCompoundCS", _wrap_SpatialReference_SetCompoundCS, METH_VARARGS, (char *)"\n"
12949
"SpatialReference_SetCompoundCS(SpatialReference self, char name, SpatialReference horizcs, \n"
12950
" SpatialReference vertcs) -> OGRErr\n"
11699
12952
{ (char *)"SpatialReference_ImportFromWkt", _wrap_SpatialReference_ImportFromWkt, METH_VARARGS, (char *)"SpatialReference_ImportFromWkt(SpatialReference self, char ppszInput) -> OGRErr"},
11700
12953
{ (char *)"SpatialReference_ImportFromProj4", _wrap_SpatialReference_ImportFromProj4, METH_VARARGS, (char *)"SpatialReference_ImportFromProj4(SpatialReference self, char ppszInput) -> OGRErr"},
11701
12954
{ (char *)"SpatialReference_ImportFromUrl", _wrap_SpatialReference_ImportFromUrl, METH_VARARGS, (char *)"SpatialReference_ImportFromUrl(SpatialReference self, char url) -> OGRErr"},
11746
13000
static swig_type_info _swigt__p_OSRCoordinateTransformationShadow = {"_p_OSRCoordinateTransformationShadow", "OSRCoordinateTransformationShadow *", 0, 0, (void*)0, 0};
11747
13001
static swig_type_info _swigt__p_OSRSpatialReferenceShadow = {"_p_OSRSpatialReferenceShadow", "OSRSpatialReferenceShadow *", 0, 0, (void*)0, 0};
11748
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
13002
static swig_type_info _swigt__p_char = {"_p_char", "char *|retStringAndCPLFree *", 0, 0, (void*)0, 0};
11749
13003
static swig_type_info _swigt__p_double = {"_p_double", "double *", 0, 0, (void*)0, 0};
11750
13004
static swig_type_info _swigt__p_int = {"_p_int", "int *|OGRErr *", 0, 0, (void*)0, 0};
11751
13005
static swig_type_info _swigt__p_long = {"_p_long", "long *", 0, 0, (void*)0, 0};