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.
383 int is_axis_order_gis_friendly, err;
385 if (SPI_OK_CONNECT != SPI_connect ())
386 lwpgerror(
"gml_is_srs_axis_order_gis_friendly: could not connect to SPI manager");
388 sprintf(query,
"SELECT srtext \
389 FROM spatial_ref_sys WHERE srid='%d'", srid);
391 err = SPI_exec(query, 1);
392 if (err < 0) lwpgerror(
"gml_is_srs_axis_order_gis_friendly: error executing query %d", err);
395 if (SPI_processed <= 0)
401 srtext = SPI_getvalue(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1);
403 is_axis_order_gis_friendly = 1;
404 if (srtext && srtext[0] !=
'\0')
407 char* srtext_horizontal = (
char*)
malloc(strlen(srtext) + 1);
408 strcpy(srtext_horizontal, srtext);
411 ptr = strstr(srtext_horizontal,
",VERT_CS[");
415 if( strstr(srtext_horizontal,
"AXIS[") == NULL &&
416 strstr(srtext_horizontal,
"GEOCCS[") == NULL )
421 is_axis_order_gis_friendly = 0;
423 else if( strstr(srtext_horizontal,
424 "AXIS[\"Latitude\",NORTH],AXIS[\"Longitude\",EAST]") != NULL )
426 is_axis_order_gis_friendly = 0;
428 else if( strstr(srtext_horizontal,
429 "AXIS[\"Northing\",NORTH],AXIS[\"Easting\",EAST]") != NULL )
431 is_axis_order_gis_friendly = 0;
433 else if( strstr(srtext_horizontal,
434 "AXIS[\"geodetic latitude (Lat)\",north,ORDER[1]") != NULL )
436 is_axis_order_gis_friendly = 0;
439 free(srtext_horizontal);
443 return is_axis_order_gis_friendly;