41 if ( !strcmp(name,
"Equals")
42 || !strcmp(name,
"Disjoint")
43 || !strcmp(name,
"Touches")
44 || !strcmp(name,
"Within")
45 || !strcmp(name,
"Overlaps")
46 || !strcmp(name,
"Crosses")
47 || !strcmp(name,
"Intersects")
48 || !strcmp(name,
"Contains")
49 || !strcmp(name,
"DWithin")
50 || !strcmp(name,
"Beyond")
51 || !strcmp(name,
"BBOX"))
68 for (i = 0; i < coord->
use; i++) {
69 if (coord->
buf[i] ==
' ') coord->
buf[i] =
',';
70 else if (coord->
buf[i] ==
',') coord->
buf[i] =
' ';
83 list *coord_min, *coord_max, *coord_pair;
84 xmlChar *content, *srsname;
100 srsname = xmlGetProp(n, (xmlChar *)
"srsName");
122 while (n->type != XML_ELEMENT_NODE) n = n->next;
124 content = xmlNodeGetContent(n->children);
127 if (!strcmp((
char *) n->name,
"lowerCorner")) {
129 "[-]?[0-9]+([.][0-9]+)?([eE][-]?[0-9]+)? [-]?[0-9]+([.][0-9]+)?([eE][-]?[0-9]+)?")) {
141 while (n->next && n->type != XML_ELEMENT_NODE) n = n->next;
143 content = xmlNodeGetContent(n->children);
146 "[-]?[0-9]+([.][0-9]+)?([eE][-]?[0-9]+)? [-]?[0-9]+([.][0-9]+)?([eE][-]?[0-9]+)?")) {
158 }
else if (!strcmp((
char *) n->name,
"coordinates")) {
161 if (!
check_regexp((
char *) content,
"^[-]?[0-9]+([.][0-9]+)?([eE][-]?[0-9]+)?,[-]?[0-9]+([.][0-9]+)?([eE][-]?[0-9]+)?[ ][-]?[0-9]+([.][0-9]+)?([eE][-]?[0-9]+)?,[-]?[0-9]+([.][0-9]+)?([eE][-]?[0-9]+)?$")) {
233 buffer *geom, *layer_name;
237 bool free_parent_srs =
false;
245 if (!strcmp((
char *) n->name,
"Disjoint"))
buffer_add_str(fe->
sql,
" ST_Disjoint(");
246 if (!strcmp((
char *) n->name,
"Touches"))
buffer_add_str(fe->
sql,
" ST_Touches(");
248 if (!strcmp((
char *) n->name,
"Overlaps"))
buffer_add_str(fe->
sql,
" ST_Overlaps(");
249 if (!strcmp((
char *) n->name,
"Crosses"))
buffer_add_str(fe->
sql,
" ST_Crosses(");
250 if (!strcmp((
char *) n->name,
"Intersects"))
buffer_add_str(fe->
sql,
" ST_Intersects(");
251 if (!strcmp((
char *) n->name,
"Contains"))
buffer_add_str(fe->
sql,
" ST_Contains(");
254 while (n->type != XML_ELEMENT_NODE) n = n->next;
262 while (n->type != XML_ELEMENT_NODE) n = n->next;
272 free_parent_srs =
true;
276 if (!strcmp((
char *) n->name,
"Box") || !strcmp((
char *) n->name,
"Envelope")) {
278 srsname = xmlGetProp(n, (xmlChar *)
"srsName");
348 xmlChar *content, *units;
349 buffer *tmp, *op, *sql, *layer_name;
362 if (!strcmp((
char *) n->name,
"Beyond"))
buffer_add_str(op,
" > ");
363 if (!strcmp((
char *) n->name,
"DWithin"))
buffer_add_str(op,
" < ");
370 while (n->type != XML_ELEMENT_NODE) n = n->next;
383 while (n->type != XML_ELEMENT_NODE) n = n->next;
402 while (n->type != XML_ELEMENT_NODE) n = n->next;
404 units = xmlGetProp(n, (xmlChar *)
"units");
406 content = xmlNodeGetContent(n->children);
409 if (!strcmp((
char *) units,
"meters") || !strcmp((
char *) units,
"#metre"))
411 else if (!strcmp((
char *) units,
"kilometers") || !strcmp((
char *) units,
"#kilometre")) {
412 km = atof((
char *) content) * 1000.0;
431 bool transform =
false;
433 assert(propertyname);
497 buffer *property, *layer_name;
508 while (n->type != XML_ELEMENT_NODE) n = n->next;
522 if (property->
use == 0) {
525 if (!strcmp((
char *) n->name,
"Box") || !strcmp((
char *) n->name,
"Envelope")) {
527 envelope =
fe_envelope(o, layer_name, fe, envelope, n);
533 for (ln = columns->
first ; ln ; ln = ln->
next) {
542 while (n->type != XML_ELEMENT_NODE) n = n->next;
544 if (!strcmp((
char *) n->name,
"Box") || !strcmp((
char *) n->name,
"Envelope")) {
545 if (!
in_list(columns, property)) {
551 envelope =
fe_envelope(o, layer_name, fe, envelope, n);
579 if ( !strcmp((
char *) n->name,
"Equals")
580 || !strcmp((
char *) n->name,
"Disjoint")
581 || !strcmp((
char *) n->name,
"Touches")
582 || !strcmp((
char *) n->name,
"Within")
583 || !strcmp((
char *) n->name,
"Overlaps")
584 || !strcmp((
char *) n->name,
"Crosses")
585 || !strcmp((
char *) n->name,
"Intersects")
586 || !strcmp((
char *) n->name,
"Contains"))
588 else if (!strcmp((
char *) n->name,
"DWithin") || !strcmp((
char *) n->name,
"Beyond"))
590 else if (!strcmp((
char *) n->name,
"BBOX"))
static buffer * fe_transform_coord_gml2_to_psql(buffer *coord)
static buffer * fe_bbox(ows *o, buffer *typename, filter_encoding *fe, xmlNodePtr n)
static buffer * fe_bbox_layer(ows *o, buffer *typename, buffer *sql, buffer *propertyname, buffer *envelope)
buffer * fe_envelope(ows *o, buffer *typename, filter_encoding *fe, buffer *envelope, xmlNodePtr n)
bool fe_is_spatial_op(char *name)
static buffer * fe_distance_functions(ows *o, buffer *typename, filter_encoding *fe, xmlNodePtr n)
buffer * fe_spatial_op(ows *o, buffer *typename, filter_encoding *fe, xmlNodePtr n)
static buffer * fe_spatial_functions(ows *o, buffer *typename, filter_encoding *fe, xmlNodePtr n)
void ows_bbox_free(ows_bbox *b)
int ows_psql_geometry_srid(ows *o, const char *geom)
void buffer_add(buffer *buf, char c)
ows_bbox * ows_bbox_init()
buffer * ows_psql_gml_to_sql(ows *o, xmlNodePtr n, const ows_srs *parent_srs)
void buffer_copy(buffer *dest, const buffer *src)
bool ows_srs_meter_units(ows *o, buffer *layer_name)
list * ows_psql_geometry_column(ows *o, buffer *layer_name)
bool in_list(const list *l, const buffer *value)
void buffer_add_str(buffer *buf, const char *str)
bool ows_srs_set_from_srsname(ows *o, ows_srs *s, const char *srsname)
bool ows_srs_set_from_srid(ows *o, ows_srs *s, int srid)
void ows_bbox_to_query(ows *o, ows_bbox *bbox, buffer *query)
bool ows_bbox_set(ows *o, ows_bbox *b, double xmin, double ymin, double xmax, double ymax, int srid)
void buffer_free(buffer *buf)
void buffer_add_int(buffer *buf, int i)
int ows_srs_get_srid_from_layer(ows *o, buffer *layer_name)
buffer * buffer_ftoa(double f)
void ows_srs_free(ows_srs *c)
buffer * fe_property_name(ows *o, buffer *typename, filter_encoding *fe, buffer *sql, xmlNodePtr n, bool check_geom_column, bool mandatory)
list * list_explode(char separator, const buffer *value)
bool check_regexp(const char *str_request, const char *str_regex)
buffer * ows_layer_prefix_to_uri(ows_layer_list *ll, buffer *layer_name_prefix)
list * list_explode_str(char separator, const char *value)
@ FE_ERROR_GEOM_PROPERTYNAME
char * buf
size to next realloc
enum fe_error_code error_code
union Ows_request::@0 request
bool honours_authority_axis_order
bool is_axis_order_gis_friendly