예제 #1
0
파일: gsplot.php 프로젝트: bthoover/iem
function plotNoData($map, $img)
{
    $layer = $map->getLayerByName("credits");
    $point = ms_newpointobj();
    $point->setXY(100, 200);
    $point->draw($map, $layer, $img, 1, "  No data found for this date! ");
}
예제 #2
0
파일: currents.php 프로젝트: raprasad/iem
function mktitle($map, $imgObj, $titlet)
{
    $layer = $map->getLayerByName("credits");
    // point feature with text for location
    $point = ms_newpointobj();
    $point->setXY(5, 12);
    $point->draw($map, $layer, $imgObj, 0, $titlet);
}
예제 #3
0
파일: lib.php 프로젝트: muthulatha/iem
function mklogolocal($map, $imgObj)
{
    $layer = $map->getLayerByName("logo");
    // point feature with text for location
    $point = ms_newpointobj();
    $point->setXY(54, 44);
    $point->draw($map, $layer, $imgObj, "logo", "");
}
예제 #4
0
파일: lib.php 프로젝트: muthulatha/iem
function mklogolocal($map, $imgObj)
{
    $layer = $map->getLayerByName("logo");
    //$layer->set("transparency", MS_GD_ALPHA);
    // point feature with text for location
    $point = ms_newpointobj();
    $point->setXY(40, 26);
    $point->draw($map, $layer, $imgObj, 0, "");
}
예제 #5
0
파일: projection.php 프로젝트: sukma279/GIS
 function Projection($inX, $inY, $fromPrj, $toPrj)
 {
     $poPoint = ms_newpointobj();
     $poPoint->setXY($inX, $inY);
     if ($fromPrj && $toPrj && $fromPrj != $toPrj) {
         if ($_SESSION['MS_VERSION'] >= 6) {
             $fromPrjObj = new projectionObj($fromPrj);
             $toPrjObj = new projectionObj($toPrj);
         } else {
             $fromPrjObj = ms_newprojectionobj($fromPrj);
             $toPrjObj = ms_newprojectionobj($toPrj);
         }
         $poPoint->project($fromPrjObj, $toPrjObj);
     }
     $this->x = $poPoint->x;
     $this->y = $poPoint->y;
 }
예제 #6
0
파일: iemmap.php 프로젝트: muthulatha/iem
function iemmap_title($map, $img, $title = null, $subtitle = null)
{
    $iem_headerbar = $map->getLayerByName("iem_headerbar");
    $iem_headerbar->set("status", MS_ON);
    $iem_headerbar_logo = $map->getLayerByName("iem_headerbar_logo");
    $iem_headerbar_logo->set("status", MS_ON);
    $iem_headerbar->draw($img);
    $iem_headerbar_logo->draw($img);
    $iem_headerbar_title = $map->getLayerByName("iem_headerbar_title");
    $iem_headerbar_title->set("status", MS_ON);
    if ($title != null) {
        $point = ms_newpointobj();
        $point->setXY(80, 28);
        $point->draw($map, $iem_headerbar_title, $img, 0, $title);
    }
    if ($subtitle != null) {
        $point = ms_newpointobj();
        $point->setXY(82, 50);
        $point->draw($map, $iem_headerbar_title, $img, 1, $subtitle);
    }
}
예제 #7
0
파일: kcau.php 프로젝트: muthulatha/iem
$logokey_c0s0->set("size", 55);
$logokey_c0s0->color->setRGB(0,0,0);
$logokey_c0->label->set("buffer", 20);
$logokey_c0->label->set("type", MS_BITMAP);
$logokey_c0->label->set("size", MS_GIANT);
$logokey_c0->label->color->setRGB(0,0,0);
$logopt = ms_newpointobj();
$logopt->setXY(350, 105);
$logopt->draw($map, $logokey, $img, 0, "            ");
$logopt->free();

$logokey_c2 = ms_newClassObj($logokey);
$logokey_c2s0 = ms_newStyleObj($logokey_c2);
$logokey_c2s0->set("symbolname", "iem_isp");
//$logokey_c2s0->set("size", 45);
$logokey_c2->label->set("buffer", 20);
$logokey_c2->label->set("type", MS_BITMAP);
$logokey_c2->label->set("size", MS_GIANT);
$logokey_c2->label->color->setRGB(0,0,0);
$iempt = ms_newpointobj();
$iempt->setXY(560, 185);
$iempt->draw($map, $logokey, $img, 1 , "                ");
*/
$map->drawLabelCache($img);
$layer = $map->getLayerByName("credits");
$c = $layer->getClass(0);
$point = ms_newpointobj();
$point->setXY(500, 10);
$point->draw($map, $layer, $img, 0, $valid);
header("Content-type: image/jpeg");
$img->saveImage('');
예제 #8
0
function ProcessURLArray($aVars)
{
    //simpan tool navigasi yang sedang aktif
    $GLOBALS["gszCurrentTool"] = isset($aVars["CMD"]) ? $aVars["CMD"] : "ZOOM_IN";
    //set batas koordinat peta
    $oExt = $GLOBALS["goMap"];
    $fMinX = isset($aVars["MINX"]) ? $aVars["MINX"] : $oExt->extent->minx;
    $fMinY = isset($aVars["MINY"]) ? $aVars["MINY"] : $oExt->extent->miny;
    $fMaxX = isset($aVars["MAXX"]) ? $aVars["MAXX"] : $oExt->extent->maxx;
    $fMaxY = isset($aVars["MAXY"]) ? $aVars["MAXY"] : $oExt->extent->maxy;
    $GLOBALS["goMap"]->setextent($fMinX, $fMinY, $fMaxX, $fMaxY);
    //lebar dan tinggi gambar peta
    $fW = $GLOBALS["goMap"]->width;
    $fH = $GLOBALS["goMap"]->height;
    if (isset($_GET["legendlayername"])) {
        for ($i = 0; $i < $GLOBALS["goMap"]->numlayers; $i++) {
            $oLayer = $GLOBALS["goMap"]->getLayer($i);
            if (in_array($oLayer->name, $_GET["legendlayername"])) {
                $oLayer->set("status", MS_ON);
            } else {
                $oLayer->set("status", MS_OFF);
            }
        }
    }
    //lakukan perubahan skala, sesuai tool navigasi terpilih
    if (isset($aVars["CMD"]) && isset($aVars["MAINMAP_x"])) {
        //titik tempat user meng-klik pada lokasi peta
        $nX = isset($aVars["MAINMAP_x"]) ? intval($aVars["MAINMAP_x"]) : $fW / 2.0;
        $nY = isset($aVars["MAINMAP_y"]) ? intval($aVars["MAINMAP_y"]) : $fW / 2.0;
        if (isset($aVars["MAINMAP_x"]) && isset($aVars["MAINMAP_y"])) {
            $oPixelPos = ms_newpointobj();
            $oPixelPos->setxy($nX, $nY);
            $oGeoExt = ms_newrectobj();
            $oGeoExt->setextent($fMinX, $fMinY, $fMaxX, $fMaxY);
            //ubah skala peta, dengan method zoompoint atau setextent
            if ($aVars["CMD"] == "ZOOM_IN") {
                $GLOBALS["goMap"]->zoompoint(2, $oPixelPos, $fW, $fH, $oGeoExt);
            } else {
                if ($aVars["CMD"] == "ZOOM_OUT") {
                    $GLOBALS["goMap"]->zoompoint(-2, $oPixelPos, $fW, $fH, $oGeoExt);
                } else {
                    if ($aVars["CMD"] == "RECENTER") {
                        $GLOBALS["goMap"]->zoompoint(1, $oPixelPos, $fW, $fH, $oGeoExt);
                    } else {
                        if ($aVars["CMD"] == "ZOOM_ALL") {
                            $GLOBALS["goMap"]->setextent($GLOBALS["gfMinX"], $GLOBALS["gfMinY"], $GLOBALS["gfMaxX"], $GLOBALS["gfMaxY"]);
                        } else {
                            if ($aVars["CMD"] == "QUERY") {
                                $nGeoX = Pix2Geo($nX, 0, $fW, $fMinX, $fMaxX, 0);
                                $nGeoY = Pix2Geo($nY, 0, $fH, $fMinY, $fMaxY, 1);
                                $oGeo = ms_newPointObj();
                                $oGeo->setXY($nGeoX, $nGeoY);
                                // Simbol '@' digunakan supaya tidak muncul pesan peringatan
                                // ketika objek tidak ditemukan
                                @$GLOBALS["goMap"]->queryByPoint($oGeo, MS_SINGLE, -1);
                                $GLOBALS["gShowQueryResults"] = TRUE;
                            }
                        }
                    }
                }
            }
        }
    } else {
        if (isset($aVars["KEYMAP_x"]) && isset($aVars["KEYMAP_y"])) {
            $oRefExt = $GLOBALS["goMap"]->reference->extent;
            $nX = intval($aVars["KEYMAP_x"]);
            $nY = intval($aVars["KEYMAP_y"]);
            $fWidthPix = doubleval($GLOBALS["goMap"]->reference->width);
            $fHeightPix = doubleval($GLOBALS["goMap"]->reference->height);
            $nGeoX = Pix2Geo($nX, 0, $fWidthPix, $oRefExt->minx, $oRefExt->maxx, 0);
            $nGeoY = Pix2Geo($nY, 0, $fHeightPix, $oRefExt->miny, $oRefExt->maxy, 1);
            $fDeltaX = ($fMaxX - $fMinX) / 2.0;
            $fDeltaY = ($fMaxY - $fMinY) / 2.0;
            $GLOBALS["goMap"]->setextent($nGeoX - $fDeltaX, $nGeoY - $fDeltaY, $nGeoX + $fDeltaX, $nGeoY + $fDeltaY);
        }
    }
}
예제 #9
0
function geo2utm($x, $y, $zona)
{
    $projInObj = ms_newprojectionobj("proj=longlat,ellps=WGS84,datum=WGS84,no_defs");
    if ($y < 0) {
        $ns = "south";
    } else {
        $ns = "north";
    }
    $projOutObj = ms_newprojectionobj("proj=utm,zone={$zona},{$ns},ellps=GRS67,units=m,no_defs");
    $poPoint = ms_newpointobj();
    $poPoint->setXY($x, $y);
    $poPoint->project($projInObj, $projOutObj);
    return array("x" => round($poPoint->x, 2), "y" => round($poPoint->y, 2), "zona" => $zona, "datum" => "SAD-69");
}
예제 #10
0
파일: ogc.php 프로젝트: edmarmoretti/i3geo
 }
 $n = pow(2, $z);
 $lon1 = $x / $n * 360.0 - 180.0;
 $lat2 = rad2deg(atan(sinh(pi() * (1 - 2 * $y / $n))));
 $x++;
 $y++;
 $lon2 = $x / $n * 360.0 - 180.0;
 $lat1 = rad2deg(atan(sinh(pi() * (1 - 2 * $y / $n))));
 $x--;
 $y--;
 $projInObj = ms_newprojectionobj($projDefault["proj4"]);
 $projOutObj = ms_newprojectionobj("proj=merc,a=6378137,b=6378137,lat_ts=0.0,lon_0=0.0,x_0=0.0,y_0=0,k=1.0,units=m");
 $poPoint1 = ms_newpointobj();
 $poPoint1->setXY($lon1, $lat1);
 $poPoint1->project($projInObj, $projOutObj);
 $poPoint2 = ms_newpointobj();
 $poPoint2->setXY($lon2, $lat2);
 $poPoint2->project($projInObj, $projOutObj);
 $oMap->setsize(256, 256);
 $oMap->setExtent($poPoint1->x, $poPoint1->y, $poPoint2->x, $poPoint2->y);
 $oMap->getlayer(0)->set("status", MS_DEFAULT);
 $oMap->setProjection("proj=merc,a=6378137,b=6378137,lat_ts=0.0,lon_0=0.0,x_0=0.0,y_0=0,k=1.0,units=m");
 $layer0->setProjection($projDefault["proj4"]);
 //
 //se o layer foi marcado para corte altera os parametros para ampliar o mapa
 //antes de gerar a imagem
 //
 if ($cortePixels > 0) {
     //$oMap->prepareImage();
     $escalaInicial = $oMap->scaledenom;
     $extensaoInicial = $oMap->extent;
예제 #11
0
 function projetaDistancia($shape, $distancia)
 {
     error_reporting(0);
     $pt = $shape->getCentroid();
     $projInObj = ms_newprojectionobj("proj=longlat,ellps=WGS84,datum=WGS84,no_defs");
     $projOutObj = ms_newprojectionobj("proj=poly,ellps=GRS67,lat_0=0,lon_0=" . $pt->x . ",x_0=5000000,y_0=10000000");
     $poPoint = ms_newpointobj();
     $poPoint->setXY($pt->x, $pt->y);
     $poPoint->project($projInObj, $projOutObj);
     $dd2 = ms_newpointobj();
     $dd2->setXY($poPoint->x + $distancia, $poPoint->y);
     $dd2->project($projOutObj, $projInObj);
     $d = $pt->distanceToPoint($dd2);
     if ($d < 0) {
         $d = $d * -1;
     }
     return $d;
 }
예제 #12
0
 function gradeDeHex($dd, $px, $py, $locaplic, $nptx, $npty, $proj = false)
 {
     set_time_limit(180);
     // http://gmc.yoyogames.com/index.php?showtopic=336183
     $hh = sin(deg2rad(30)) * $dd;
     $rr = cos(deg2rad(30)) * $dd;
     // para manipular dbf
     if ($this->dbaseExiste == false) {
         include_once dirname(__FILE__) . "/../pacotes/phpxbase/api_conversion.php";
     }
     $nomegrade = nomeRandomico();
     $nomeshp = $this->diretorio . "/" . $nomegrade;
     // pega a extens&atilde;o geogr&aacute;fica do mapa
     $this->mapa->preparequery();
     $r = $this->mapa->extent;
     $ext = ms_newRectObj();
     $ext->setextent($r->minx, $r->miny, $r->maxx, $r->maxy);
     if ($proj == true) {
         // caso precise projetar
         $projInObj = ms_newprojectionobj("proj=latlong,a=6378137,b=6378137");
         $projOutObj = ms_newprojectionobj("proj=merc,a=6378137,b=6378137,lat_ts=0.0,lon_0=0.0,x_0=0.0,y_0=0,k=1.0,units=m");
         $ext->project($projInObj, $projOutObj);
         $pt = ms_newpointobj();
         $pt->setXY($px, $py);
         $pt->project($projInObj, $projOutObj);
         $px = $pt->x;
         $py = $pt->y;
     }
     $fx = $ext->maxx;
     $fy = $ext->miny;
     // calcula a dist&acirc;ncia entre os pontos em dd se nao tiver sido especificada ou for 0
     $distx = $fx - $px;
     $disty = $fy - $py;
     if ($distx < 0) {
         $distx = $distx * -1;
     }
     if ($disty < 0) {
         $disty = $disty * -1;
     }
     if ($nptx == "") {
         $nptx = round($distx / $dd, 0);
     }
     if ($npty == "") {
         $npty = round($disty / $dd, 0);
     }
     // cria o shapefile
     $novoshpf = ms_newShapefileObj($nomeshp, MS_SHP_POLYGON);
     $def = array();
     $def[] = array("id", "C", "20");
     if ($this->dbaseExiste == false) {
         $db = xbase_create($nomeshp . ".dbf", $def);
         xbase_close($db);
     } else {
         $db = dbase_create($nomeshp . ".dbf", $def);
         dbase_close($db);
     }
     // acrescenta os pontos no novo shapefile
     $dbname = $nomeshp . ".dbf";
     if ($this->dbaseExiste == false) {
         $db = xbase_open($dbname, 2);
     } else {
         $db = dbase_open($dbname, 2);
     }
     $reg = array();
     $w = $this->mapa->width;
     $h = $this->mapa->height;
     $valorcoluna = $px;
     $par = false;
     for ($coluna = 0; $coluna < $nptx; $coluna++) {
         $x = $valorcoluna;
         $valorlinha = $py;
         if ($par == true) {
             $valorlinha = $valorlinha - $rr;
             $par = false;
         } else {
             // $y = $y + $hh;
             $par = true;
         }
         for ($linha = 0; $linha < $npty; $linha++) {
             $y = $valorlinha;
             $valorlinha = $valorlinha - 2 * $rr;
             $poPoint1 = ms_newpointobj();
             $poPoint2 = ms_newpointobj();
             $poPoint3 = ms_newpointobj();
             $poPoint4 = ms_newpointobj();
             $poPoint5 = ms_newpointobj();
             $poPoint6 = ms_newpointobj();
             // Point 0: $x, $y
             // Point 1: x + s, y
             // Point 2: x + s + h, y + r
             // Point 3: x + s, y + r + r
             // Point 4: x, y + r + r
             // Point 5: x - h, y + r
             $poPoint1->setXY($x, $y);
             $poPoint2->setXY($x + $dd, $y);
             $poPoint3->setXY($x + $dd + $hh, $y - $rr);
             $poPoint4->setXY($x + $dd, $y - $rr - $rr);
             $poPoint5->setXY($x, $y - $rr - $rr);
             $poPoint6->setXY($x - $hh, $y - $rr);
             if ($proj == true) {
                 $poPoint1->project($projOutObj, $projInObj);
                 $poPoint2->project($projOutObj, $projInObj);
                 $poPoint3->project($projOutObj, $projInObj);
                 $poPoint4->project($projOutObj, $projInObj);
                 $poPoint5->project($projOutObj, $projInObj);
                 $poPoint6->project($projOutObj, $projInObj);
             }
             $linhas = ms_newLineObj();
             $linhas->add($poPoint1);
             $linhas->add($poPoint2);
             $linhas->add($poPoint3);
             $linhas->add($poPoint4);
             $linhas->add($poPoint5);
             $linhas->add($poPoint6);
             $linhas->add($poPoint1);
             $shapen = ms_newShapeObj(MS_SHP_POLYGON);
             $shapen->add($linhas);
             $novoshpf->addShape($shapen);
             $reg[] = $linha . "-" . $coluna;
             if ($this->dbaseExiste == false) {
                 xbase_add_record($db, $reg);
             } else {
                 dbase_add_record($db, $reg);
             }
             $reg = array();
         }
         $valorcoluna = $valorcoluna + $dd + $hh;
     }
     if ($this->dbaseExiste == false) {
         xbase_close($db);
     } else {
         dbase_close($db);
     }
     // adiciona o novo tema no mapa
     $novolayer = criaLayer($this->mapa, MS_LAYER_POLYGON, MS_DEFAULT, "Grade (" . $nomegrade . ")", $metaClasse = "SIM");
     $novolayer->set("data", $nomeshp . ".shp");
     $novolayer->setmetadata("DOWNLOAD", "SIM");
     $novolayer->setmetadata("TEMALOCAL", "SIM");
     $novolayer->set("opacity", "50");
     if (file_exists($this->qyfile)) {
         unlink($this->qyfile);
     }
     return "ok";
 }
예제 #13
0
파일: Query.php 프로젝트: kanbang/Colt
 $bRasterMaxSet = 0;
 for ($j = 0; $j < $nCount; $j++) {
     $aKeyVal = explode("=", $aProcessings[$j]);
     if (count($aKeyVal) == 2 && strcasecmp(trim($aKeyVal[0]), "RASTER_QUERY_MAX_RESULT") == 0) {
         $bRasterMaxSet = 1;
         break;
     }
 }
 if (!$bRasterMaxSet) {
     $oLayer->setprocessing("RASTER_QUERY_MAX_RESULT=100");
 }
 /*are we doing a point query? In that case maxfeatures was set to 1*/
 /*this is not ideal but It is better to use querybypoint when we do point query and
   a query by shape when we do other type of queries*/
 if (isset($_REQUEST['maxfeatures']) && $_REQUEST['maxfeatures'] == '1') {
     $oCenterPoint = ms_newpointobj();
     $oPoint = $oSpatialFilter->getCentroid();
     $status = @$oLayer->queryByPoint($oPoint, MS_SINGLE, -1);
 } else {
     $status = @$oLayer->queryByShape($oSpatialFilter);
 }
 if ($status == MS_SUCCESS) {
     $result->hasSelection = true;
     $layerName = $oLayer->name;
     array_push($result->layers, $layerName);
     $result->{$layerName}->featureCount = $oLayer->getNumResults();
     //TODO: dump out the extents of the selection
 }
 if ($bExtendSelection) {
 } else {
 }
예제 #14
0
 function insereSHP($xy, $projecao, $item = "", $valor = "")
 {
     if (!$this->layer) {
         return "erro";
     }
     if ($this->dbaseExiste == false) {
         include_once dirname(__FILE__) . "/../pacotes/phpxbase/api_conversion.php";
     }
     $xy = explode(" ", $xy);
     $data = $this->layer->data;
     $data = explode(".shp", $data);
     $data = $data[0];
     $items = pegaItens($this->layer);
     $dbname = $data . ".dbf";
     if ($this->dbaseExiste == false) {
         $db = xbase_open($dbname, 2);
     } else {
         $db = dbase_open($dbname, 2);
     }
     for ($i = 0; $i < count($xy) / 2; ++$i) {
         $reg = array();
         foreach ($items as $ni) {
             //verifica se deve acrescentar o valor para um item, caso tenha sido definido
             if ($ni == $item) {
                 $reg[] = $valor;
             } else {
                 $reg[] = "-";
             }
         }
         if ($this->dbaseExiste == false) {
             xbase_add_record($db, $reg);
         } else {
             dbase_add_record($db, $reg);
         }
     }
     if ($this->dbaseExiste == false) {
         xbase_close($db);
     } else {
         dbase_close($db);
     }
     if (@($shapefileObj = ms_newShapefileObj($data, -2))) {
         for ($i = 0; $i < count($xy); $i = $i + 2) {
             $poPoint = ms_newpointobj();
             $poPoint->setXY($xy[$i], $xy[$i + 1]);
             if ($projecao != "") {
                 //$projOutObj = ms_newprojectionobj("proj=longlat,ellps=WGS84,datum=WGS84,no_defs");
                 $pmap = pegaProjecaoDefault("proj4");
                 $projOutObj = ms_newprojectionobj($pmap);
                 $projInObj = ms_newprojectionobj("init=epsg:" . $projecao);
                 $poPoint->project($projInObj, $projOutObj);
             }
             $shapefileObj->addpoint($poPoint);
         }
         return "ok";
     } else {
         return "erro";
     }
 }
예제 #15
0
파일: squery.php 프로젝트: sukma279/GIS
 function dumpXYQueryResults()
 {
     $pearDbClass = $_SESSION['pearDbClass'];
     require_once "{$pearDbClass}.php";
     $eqr = $_SESSION["equeryRect"];
     // XY Layer Properties
     $XYLayerProperties = $this->glayer->getXYLayerProperties();
     if ($XYLayerProperties['noQuery']) {
         return false;
     }
     $dsn = $XYLayerProperties["dsn"];
     $xyTable = $XYLayerProperties["xyTable"];
     $x_fld = $XYLayerProperties["x_fld"];
     $y_fld = $XYLayerProperties["y_fld"];
     $classidx_fld = $XYLayerProperties["classidx_fld"];
     $oid_fld = $XYLayerProperties["oid_fld"];
     $resFieldList = $this->glayer->getResFields();
     $resFldStr = join(',', $resFieldList);
     // Prepare SQL query
     if (preg_match("/@/", $xyTable)) {
         // Check for WHERE filter in table definition
         $xyList = preg_split('/@/', $xyTable);
         $whereFilter = $xyList[1];
         $xyTable = $xyList[0];
     }
     $sql_select = "SELECT {$x_fld}, {$y_fld}, {$resFldStr} FROM {$xyTable}";
     $qr = $this->xyLayQueryList;
     $changeLayProj = PMCommon::checkProjection($this->map, $this->qLayer);
     // Map extent for limiting query
     if ($changeLayProj) {
         $mapExt = ms_newRectObj();
         $mapExt->setExtent($qr["xmin"], $qr["ymin"], $qr["xmax"], $qr["ymax"]);
         $mapExt->project($changeLayProj['mapProj'], $changeLayProj['layProj']);
         $qxmin = $mapExt->minx;
         $qymin = $mapExt->miny;
         $qxmax = $mapExt->maxx;
         $qymax = $mapExt->maxy;
     } else {
         $qxmin = $qr["xmin"];
         $qymin = $qr["ymin"];
         $qxmax = $qr["xmax"];
         $qymax = $qr["ymax"];
     }
     if ($this->search) {
         $sql_where = "WHERE " . ($whereFilter ? $whereFilter . " AND " : "") . $qr;
     } else {
         $sql_where = "WHERE " . ($whereFilter ? $whereFilter . " AND " : "") . " {$x_fld} >= {$qxmin} AND {$x_fld} <= {$qxmax} AND {$y_fld} >= {$qymin} AND {$y_fld} <= {$qymax} ";
     }
     $sql = "{$sql_select}  {$sql_where}";
     pm_logDebug(3, $query, "P.MAPPER-DEBUG: squery.php/dumpXYQueryResults() - SQL Cmd:");
     // init DB class
     $db = new $pearDbClass();
     // Connect to DB
     $dbh = $db->connect($dsn);
     if ($db->isError($dbh)) {
         PMCommon::db_logErrors($dbh);
         die;
     }
     // Execute query
     $res = $dbh->query($sql);
     if ($db->isError($res)) {
         PMCommon::db_logErrors($res);
         die;
     }
     $this->mExtMinx = 999999999;
     $this->mExtMiny = 999999999;
     $this->mExtMaxx = -999999999;
     $this->mExtMaxy = -999999999;
     // Now print results as JSON
     $nres = 0;
     $numrows = $res->numRows();
     while ($row = $res->fetchRow(2)) {
         if ($changeLayProj) {
             $nP = ms_newpointobj();
             $nP->setXY($row["{$x_fld}"], $row["{$y_fld}"]);
             $nP->project($changeLayProj['layProj'], $changeLayProj['mapProj']);
             $rx = $nP->x;
             $ry = $nP->y;
         } else {
             $rx = $row["{$x_fld}"];
             $ry = $row["{$y_fld}"];
         }
         $buf = $this->pointBuffer;
         //error_log($buf);
         $shpMinx = $rx - $buf;
         $shpMiny = $ry - $buf;
         $shpMaxx = $rx + $buf;
         $shpMaxy = $ry + $buf;
         if ($this->zoomFull) {
             $this->mExtMinx = min($this->mExtMinx, $shpMinx);
             $this->mExtMiny = min($this->mExtMiny, $shpMiny);
             $this->mExtMaxx = max($this->mExtMaxx, $shpMaxx);
             $this->mExtMaxy = max($this->mExtMaxy, $shpMaxy);
         }
         // Link for zoom to feature
         $qShpIdx = $row["{$oid_fld}"];
         $this->resultindexes[] = $row["{$x_fld}"] . "@" . $row["{$y_fld}"];
         // Output JSON
         //$qShpLink = "{\"shplink\": [\"0\",\"0\",\"" . $shpMinx ."+". $shpMiny ."+". $shpMaxx ."+". $shpMaxy ."\,0"]}";
         $qShpLink = "{\"shplink\": [\"" . $this->qLayerName . "\",\"" . $qShpIdx . "\",\"" . $shpMinx . "+" . $shpMiny . "+" . $shpMaxx . "+" . $shpMaxy . "\"" . ($this->zoomFull ? ",1" : ",0") . "]}";
         if ($nres > 0) {
             $this->qStr .= ", ";
         }
         // Add shape link
         $this->qStr .= "[" . $qShpLink;
         // Add 'normal' field values
         foreach ($resFieldList as $fn) {
             $this->qStr .= $this->printFieldValues($fn, $row["{$fn}"]);
         }
         $this->qStr .= "]";
         $nres++;
         // Stop query if result records exceed limit set in config.ini
         if ($nres > $this->limitResult) {
             break;
         }
     }
     $this->numResults = $nres;
     $res->free();
     $dbh->disconnect();
 }