Allow passing NULL box to getEdgeWithinBox2D

git-svn-id: http://svn.osgeo.org/postgis/trunk@15236 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Sandro Santilli 2016-11-18 11:22:27 +00:00
parent 05e4b56eb9
commit 3d30d893d2
2 changed files with 9 additions and 5 deletions

View file

@ -457,7 +457,7 @@ typedef struct LWT_BE_CALLBACKS_T {
* Get edges whose bounding box overlaps a given 2D bounding box
*
* @param topo the topology to act upon
* @param box the query box
* @param box the query box, to be considered infinite if NULL
* @param numelems output parameter, gets number of elements found
* if the return is not null, otherwise see @return
* section for semantic.

View file

@ -2736,10 +2736,14 @@ cb_getEdgeWithinBox2D ( const LWT_BE_TOPOLOGY* topo, const GBOX* box,
appendStringInfoString(sql, "SELECT ");
addEdgeFields(sql, fields, 0);
}
hexbox = _box2d_to_hexwkb(box, topo->srid);
appendStringInfo(sql, " FROM \"%s\".edge WHERE geom && '%s'::geometry",
topo->name, hexbox);
lwfree(hexbox);
appendStringInfo(sql, " FROM \"%s\".edge", topo->name, hexbox);
if ( box ) {
hexbox = _box2d_to_hexwkb(box, topo->srid);
appendStringInfo(sql, " WHERE geom && '%s'::geometry", hexbox);
lwfree(hexbox);
}
if ( elems_requested == -1 ) {
appendStringInfoString(sql, ")");
} else if ( elems_requested > 0 ) {