Return 1 if the SRS definition from the authority has a GIS friendly order, that is easting,northing.
This is typically true for most projected CRS (but not all!), and this is false for EPSG geographic CRS.
431 int is_axis_order_gis_friendly, err;
433 if (SPI_OK_CONNECT != SPI_connect ())
434 lwpgerror(
"gml_is_srs_axis_order_gis_friendly: could not connect to SPI manager");
436 sprintf(query,
"SELECT srtext \
437 FROM spatial_ref_sys WHERE srid='%d'", srid);
439 err = SPI_exec(query, 1);
440 if (err < 0) lwpgerror(
"gml_is_srs_axis_order_gis_friendly: error executing query %d", err);
443 if (SPI_processed <= 0)
449 srtext = SPI_getvalue(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1);
451 is_axis_order_gis_friendly = 1;
452 if (srtext && srtext[0] !=
'\0')
455 char* srtext_horizontal = (
char*)
malloc(strlen(srtext) + 1);
456 strcpy(srtext_horizontal, srtext);
459 ptr = strstr(srtext_horizontal,
",VERT_CS[");
463 if( strstr(srtext_horizontal,
"AXIS[") == NULL &&
464 strstr(srtext_horizontal,
"GEOCCS[") == NULL )
469 is_axis_order_gis_friendly = 0;
471 else if( strstr(srtext_horizontal,
472 "AXIS[\"Latitude\",NORTH],AXIS[\"Longitude\",EAST]") != NULL )
474 is_axis_order_gis_friendly = 0;
476 else if( strstr(srtext_horizontal,
477 "AXIS[\"Northing\",NORTH],AXIS[\"Easting\",EAST]") != NULL )
479 is_axis_order_gis_friendly = 0;
481 else if( strstr(srtext_horizontal,
482 "AXIS[\"geodetic latitude (Lat)\",north,ORDER[1]") != NULL )
484 is_axis_order_gis_friendly = 0;
487 free(srtext_horizontal);
491 return is_axis_order_gis_friendly;