61 c = malloc(
sizeof(*g));
62 return memcpy(c, g,
sizeof(*g));
82 double geom_tolerance = 0.01;
86 if (south + geom_tolerance < -90.0 || south - geom_tolerance > 90.0 ||
87 north + geom_tolerance < -90.0 || north - geom_tolerance > 90.0 ||
88 east + geom_tolerance < -180.0 || east - geom_tolerance > 180.0 ||
89 west + geom_tolerance < -180.0 || west - geom_tolerance > 180.0)
92 if (fabs(south - north) < DBL_EPSILON || fabs(east - west) < DBL_EPSILON)
110 double west, east, south, north;
115 if (bb->
ymin < 0.0 && bb->
ymax < 0.0) {
155 double xmin, ymin, xmax, ymax;
168 if( geom->
first == NULL )
174 xmin = ymin = xmax = ymax = 0.0;
176 for (ln = geom->
first; ln ; ln = ln->
next) {
177 buffer_add_str(sql,
"SELECT ST_xmin(g), ST_ymin(g), ST_xmax(g), ST_ymax(g) FROM ");
179 buffer_add_str(sql,
"(SELECT ST_Transform(ST_SetSRID(ST_Estimated_Extent('");
193 buffer_add_str(sql,
"(SELECT ST_Transform(ST_SetSRID(ST_Extent(\"");
211 if (PQresultStatus(res) != PGRES_TUPLES_OK) {
217 if (first || atof(PQgetvalue(res, 0, 0)) < xmin) xmin = atof(PQgetvalue(res, 0, 0));
218 if (first || atof(PQgetvalue(res, 0, 1)) < ymin) ymin = atof(PQgetvalue(res, 0, 1));
219 if (first || atof(PQgetvalue(res, 0, 2)) > xmax) xmax = atof(PQgetvalue(res, 0, 2));
220 if (first || atof(PQgetvalue(res, 0, 3)) > ymax) ymax = atof(PQgetvalue(res, 0, 3));
void ows_bbox_free(ows_bbox *b)
void buffer_empty(buffer *buf)
ows_bbox * ows_bbox_init()
PGresult * ows_psql_exec(ows *o, const char *sql)
void buffer_copy(buffer *dest, const buffer *src)
list * ows_psql_geometry_column(ows *o, buffer *layer_name)
void buffer_add_str(buffer *buf, const char *str)
bool ows_bbox_set_from_str(ows *o, ows_bbox *bb, const char *str, int srid, bool honours_authority_axis_order_if_no_explicit_srs)
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 ows_geobbox_flush(const ows_geobbox *g, FILE *output)
buffer * ows_psql_table_name(ows *o, buffer *layer_name)
buffer * ows_psql_schema_name(ows *o, buffer *layer_name)
ows_geobbox * ows_geobbox_compute(ows *o, buffer *layer_name)
bool ows_geobbox_set_from_bbox(ows *o, ows_geobbox *g, ows_bbox *bb)
void ows_geobbox_free(ows_geobbox *g)
ows_geobbox * ows_geobbox_copy(ows_geobbox *g)
ows_geobbox * ows_geobbox_init()
bool ows_geobbox_set(ows *o, ows_geobbox *g, double west, double east, double south, double north)
ows_geobbox * ows_geobbox_set_from_str(ows *o, ows_geobbox *g, char *str)
struct List_node list_node
struct Ows_geobbox ows_geobbox
char * buf
size to next realloc