- try {
- $features = $this->listfeatures ();
- } catch (Exception $e) {
- return array ($minlon, $minlat, $maxlon, $maxlat);
- }
-
- if (count ($features) == 0) {
- return array ($minlon, $minlat, $maxlon, $maxlat);
- } else if (count ($features) == 1) {
- // in case there's only one feature, we show an area of at least
- // 4 x 4 degrees
- $feature = $features [0];
-
- $minlon = max ($feature->lon - 2, -180);
- $maxlon = min ($feature->lon + 2, 180);
- $minlat = max ($feature->lat - 2, -90);
- $maxlat = min ($feature->lat + 2, 90);
-
- return array ($minlon, $minlat, $maxlon, $maxlat);
- } else {
- foreach ($features as $feature) {
- $minlon = min ($feature->lon, $minlon);
- $minlat = min ($feature->lat, $minlat);
- $maxlon = max ($feature->lon, $maxlon);
- $maxlat = max ($feature->lat, $maxlat);
+ $features = array ();
+ $res = $this->_execute_query ($query);
+ while ($row = mysql_fetch_assoc ($res)) {
+ $feature = $this->_feature_frow_row ($row);
+ if (isset ($feature)) {
+ $features[] = $feature;