96 fprintf(output,
"[\n");
97 fprintf(output,
" srid: %i\n", c->
srid);
99 fprintf(output,
" auth_srid: %i\n", c->
auth_srid);
102 fprintf(output,
" is_geographic: true\n]\n");
104 fprintf(output,
" is_geographic: false\n]\n");
107 fprintf(output,
" honours_authority_axis_order: true\n]\n");
109 fprintf(output,
" honours_authority_axis_order: false\n]\n");
112 fprintf(output,
" is_axis_order_gis_friendly: true\n]\n");
114 fprintf(output,
" is_axis_order_gis_friendly: false\n]\n");
117 fprintf(output,
" is_long: true\n]\n");
119 fprintf(output,
" is_long: false\n]\n");
128 ows_srs* s,
const char* proj4text,
const char* srtext)
131 if (srtext && srtext[0] !=
'\0')
133 char* srtext_horizontal = (
char*) malloc(strlen(srtext) + 1);
135 strcpy(srtext_horizontal, srtext);
138 ptr = strstr(srtext_horizontal,
",VERT_CS[");
144 strstr(srtext,
"GEOCCS[") == NULL &&
145 strstr(srtext,
"BOUNDCRS[") == NULL) ||
146 strstr(srtext,
"BOUNDCRS[SOURCECRS[GEOGCRS") != NULL;
148 if( strstr(srtext_horizontal,
"AXIS[") == NULL &&
149 strstr(srtext_horizontal,
"GEOCCS[") == NULL )
156 else if( strstr(srtext_horizontal,
157 "AXIS[\"Latitude\",NORTH],AXIS[\"Longitude\",EAST]") != NULL )
161 else if( strstr(srtext_horizontal,
162 "AXIS[\"Northing\",NORTH],AXIS[\"Easting\",EAST]") != NULL )
166 else if( strstr(srtext_horizontal,
167 "AXIS[\"geodetic latitude (Lat)\",north,ORDER[1]") != NULL )
172 free(srtext_horizontal);
174 else if( proj4text && proj4text[0] !=
'\0' )
189 const char* proj4text;
199 "FROM spatial_ref_sys WHERE auth_name='");
208 if (PQresultStatus(res) != PGRES_TUPLES_OK || PQntuples(res) != 1) {
217 s->
srid = atoi(PQgetvalue(res, 0, 0));
219 proj4text = PQgetvalue(res, 0, 1);
220 srtext = PQgetvalue(res, 0, 2);
255 const char *proj4text;
261 if (srid == -1 || srid == 0) {
273 buffer_add_str(sql,
"SELECT auth_name, auth_srid, proj4text, srtext "
274 "FROM spatial_ref_sys WHERE srid = '");
282 if (PQresultStatus(res) != PGRES_TUPLES_OK || PQntuples(res) != 1) {
288 s->
auth_srid = atoi(PQgetvalue(res, 0, 1));
291 proj4text = PQgetvalue(res, 0, 2);
292 srtext = PQgetvalue(res, 0, 3);
307 const char *p = NULL;
331 if (!strncmp((
char *) srsname,
"EPSG:", 5)
332 || !strncmp((
char *) srsname,
"spatialreferencing.org", 22)) {
337 }
else if (!strncmp((
char *) srsname,
"urn:ogc:def:crs:EPSG:", 21)
338 || !strncmp((
char *) srsname,
"urn:x-ogc:def:crs:EPSG:", 23)
339 || !strncmp((
char *) srsname,
"urn:EPSG:geographicCRS:", 23)) {
343 }
else if (!strncmp((
char *) srsname,
"http://www.opengis.net/gml/srs/epsg.xml#", 40)) {
349 for (p = srsname ; *p ; p++);
350 for (--p ; *p != sep ; p--)
351 if (!isdigit(*p))
return false;
409 if (l->
size == 0)
return srs;
411 for (ln = l->
first; ln ; ln = ln->
next) {
442 if (PQresultStatus(res) != PGRES_TUPLES_OK || PQntuples(res) != 1) {
void buffer_empty(buffer *buf)
PGresult * ows_psql_exec(ows *o, const char *sql)
void buffer_copy(buffer *dest, const buffer *src)
void buffer_add_str(buffer *buf, const char *str)
void list_add(list *l, buffer *value)
void ows_srs_flush(ows_srs *c, FILE *output)
void buffer_free(buffer *buf)
void buffer_add_int(buffer *buf, int i)
static void ows_srs_set_is_geographic_and_is_axis_order_gis_friendly_from_def(ows_srs *s, const char *proj4text, const char *srtext)
bool ows_srs_meter_units(ows *o, buffer *layer_name)
bool ows_srs_set_from_srsname(ows *o, ows_srs *s, const char *srsname)
list * ows_srs_get_from_srid(ows *o, list *l)
bool ows_srs_set_from_srid(ows *o, ows_srs *s, int srid)
int ows_srs_get_srid_from_layer(ows *o, buffer *layer_name)
bool ows_srs_set_geobbox(ows *o, ows_srs *s)
void ows_srs_free(ows_srs *c)
buffer * ows_srs_get_from_a_srid(ows *o, int srid)
bool ows_srs_set(ows *o, ows_srs *s, const buffer *auth_name, int auth_srid)
ows_srs * ows_srs_copy(ows_srs *d, ows_srs *s)
struct List_node list_node
struct Ows_layer_node ows_layer_node
char * buf
size to next realloc
struct Ows_layer_node * next
ows_layer_storage * storage
bool honours_authority_axis_order
bool is_axis_order_gis_friendly