Implies a speedup in topology loading too, whereas the
face-containing-point callback is used twice per added line.
git-svn-id: http://svn.osgeo.org/postgis/trunk@15269
b70326c6-7e19-0410-871a-
916f4a2858ee
}
/* TODO: call GetFaceGeometry internally, avoiding the round-trip to sql */
appendStringInfo(sql,
- "SELECT face_id FROM \"%s\".face "
- "WHERE mbr && $1 AND _ST_Contains("
+ "WITH faces AS ( SELECT face_id FROM \"%s\".face "
+ "WHERE mbr && $1 ORDER BY ST_Area(mbr) ASC ) "
+ "SELECT face_id FROM faces WHERE _ST_Contains("
"topology.ST_GetFaceGeometry('%s', face_id), $1)"
" LIMIT 1",
topo->name, topo->name);