Beispiel #1
0
 function getWayData($wlyrs)
 {
     $arr = array();
     if ($this->doWays) {
         $arr[] = "way";
     }
     if ($this->doPolygons) {
         $arr[] = "polygon";
     }
     foreach ($arr as $table) {
         $wqry = $this->getWayQuery($table);
         if ($wlyrs[0] != "all") {
             $wqry .= DataGetter::criteria($wlyrs);
         }
         $wqry .= DataGetter::applyFilter("way");
         $wresult = $this->conn->query($wqry);
         $errorInfo = $this->conn->errorInfo();
         if ($errorInfo[0] != "00000") {
             return;
         }
         $first = true;
         $excluded_col = $table == "polygon" ? $this->dbq->polygonDetails["col"] : $this->dbq->wayDetails["col"];
         while ($wrow = $wresult->fetch(PDO::FETCH_ASSOC)) {
             $feature = array();
             $f = json_decode($wrow['geojson'], true);
             $tags = array();
             // Replace ampersands with the word "and".
             foreach ($wrow as $k => $v) {
                 if ($k != $excluded_col && $k != 'geojson' && $v != '') {
                     $tags[$k] = htmlspecialchars(str_replace("&", "and", $v));
                 }
             }
             $feature["properties"] = $tags;
             if ($this->kothic_gran === null) {
                 $feature["type"] = "Feature";
                 $feature["geometry"] = array();
                 $feature["geometry"]["coordinates"] = $f["coordinates"];
                 $feature["geometry"]["type"] = $f["type"];
                 if (count($feature["geometry"]["coordinates"]) > 0) {
                     $this->data["features"][] = $feature;
                 }
             } else {
                 $feature["coordinates"] = $this->kothicAdjust($f);
                 $feature["type"] = $f["type"];
                 if (count($feature["coordinates"]) > 0) {
                     $this->data["features"][] = $feature;
                 }
             }
         }
     }
 }