Exemplo n.º 1
0
/**
 * @param $mapfile
 * @param $corx
 * @param $cory
 * @param $minx
 * @param $maxx
 * @param $miny
 * @param $maxy
 * @param $xsize
 * @param $ysize
 * @param $layers
 * @param $labels
 * @param $zoom
 * @param bool $changeleg
 * @param int $corx2
 * @param int $cory2
 * @return xajaxResponse
 */
function map_redraw($mapfile, $corx, $cory, $minx, $maxx, $miny, $maxy, $xsize, $ysize, $layers, $labels, $zoom, $changeleg = false, $corx2 = 0, $cory2 = 0)
{
    global $prefs;
    $objResponse = new xajaxResponse();
    if (strstr($mapfile, '..')) {
        $msg = tra('You do not have permission to do that');
        $objResponse->alert($msg);
        return $objResponse;
    }
    $prefs['map_path'] = preg_replace('/\\/?$/', '/', $prefs['map_path']);
    //checking the mapfile
    if (!is_file($prefs['map_path'] . $mapfile) || preg_match('/(\\/\\.)/', $prefs['map_path'] . $mapfile)) {
        $msg = tra('invalid mapfile name');
        $objResponse->alert($msg);
        return $objResponse;
    }
    $map = ms_newMapObj($prefs['map_path'] . $mapfile);
    for ($j = 0; $j < $map->numlayers; $j++) {
        $my_layer = $map->getLayer($j);
        if ($layers[$j] == 'true') {
            $my_layer->set('status', MS_ON);
        } else {
            $my_layer->set('status', MS_OFF);
        }
        if ($labels[$j] == 'false') {
            $my_layer->set('labelmaxscale', 0);
        }
    }
    $map->Set('width', $xsize);
    $map->Set('height', $ysize);
    $my_point = ms_newpointObj();
    if ($zoom == 3) {
        $my_point->setXY($map->width / 2, $map->height / 2);
    } else {
        $my_point->setXY(floor($corx), floor($cory));
    }
    $my_extent = ms_newrectObj();
    $my_extent->setextent($minx, $miny, $maxx, $maxy);
    $result = '';
    if ($zoom == 3) {
        $map->zoompoint(1, $my_point, $map->width, $map->height, $my_extent);
        $result = map_query($map, $corx, $cory);
    } elseif ($zoom == 5) {
        $my_rect = ms_newrectObj();
        $my_rect->setextent($corx, $cory, $corx2, $cory2);
        $map->zoomrectangle($my_rect, $map->width, $map->height, $my_extent);
        $objResponse->assign('minx', 'value', $map->extent->minx);
        $objResponse->assign('miny', 'value', $map->extent->miny);
        $objResponse->assign('maxx', 'value', $map->extent->maxx);
        $objResponse->assign('maxy', 'value', $map->extent->maxy);
        $objResponse->assign('map', 'style.cursor', 'default');
        $objResponse->assign('zoomselect', 'style.visibility', 'hidden');
        $objResponse->script("xMoveTo(xGetElementById('map'),0,0);");
        $objResponse->script('minx=' . $map->extent->minx . ';');
        $objResponse->script('miny=' . $map->extent->miny . ';');
        $objResponse->script('maxx=' . $map->extent->maxx . ';');
        $objResponse->script('maxy=' . $map->extent->maxy . ';');
    } else {
        $map->zoompoint(1, $my_point, $map->width, $map->height, $my_extent);
        $objResponse->assign('minx', 'value', $map->extent->minx);
        $objResponse->assign('miny', 'value', $map->extent->miny);
        $objResponse->assign('maxx', 'value', $map->extent->maxx);
        $objResponse->assign('maxy', 'value', $map->extent->maxy);
        $objResponse->assign('map', 'style.cursor', 'move');
        $objResponse->script("xMoveTo(xGetElementById('map'),0,0);");
        $objResponse->script('minx=' . $map->extent->minx . ';');
        $objResponse->script('miny=' . $map->extent->miny . ';');
        $objResponse->script('maxx=' . $map->extent->maxx . ';');
        $objResponse->script('maxy=' . $map->extent->maxy . ';');
    }
    $image = $map->drawquery();
    $image_url = $image->saveWebImage();
    if ($zoom != 3) {
        $image_ref = $map->drawReferenceMap();
        $image_ref_url = $image_ref->saveWebImage();
        $image_ref->free();
    }
    if ($changeleg) {
        $image_leg = $map->drawLegend();
        $image_leg_url = $image_leg->saveWebImage();
        $image_leg->free();
    }
    if ($zoom == 2 || $zoom == 5) {
        $image_scale = $map->drawScaleBar();
        $image_scale_url = $image_scale->saveWebImage();
        $image_scale->free();
    }
    $image->free();
    $objResponse->assign('innerBoxContent', 'innerHTML', $result);
    $objResponse->assign('resultBox', 'innerHTML', $result);
    $objResponse->assign('map', 'src', $image_url);
    if ($zoom != 3) {
        $objResponse->assign('ref', 'src', $image_ref_url);
    }
    if ($zoom == 2 || $zoom == 5) {
        $objResponse->assign('scale', 'src', $image_scale_url);
    }
    if ($changeleg) {
        $objResponse->assign('leg', 'src', $image_leg_url);
    }
    return $objResponse;
}
Exemplo n.º 2
0
 /**
  * Check if layer is in valid scale dimension (used for queries)
  * Based on a script by CHIP HANKLEY found on MapServer Wiki 
  */
 public static function checkScale($map, $qLayer, $scale, $mapExt = null)
 {
     if ($qLayer->maxscaledenom == -1 && $qLayer->minscaledenom == -1) {
         $ret = 1;
     } elseif ($scale > $qLayer->maxscaledenom and $qLayer->maxscaledenom != -1) {
         $ret = 0;
     } elseif ($scale < $qLayer->minscaledenom and $qLayer->minscaledenom != -1) {
         $ret = 0;
     } else {
         $ret = 1;
     }
     if (!$mapExt) {
         return $ret;
     } else {
         $me = ms_newrectObj();
         $me->setExtent($mapExt["minx"], $mapExt["miny"], $mapExt["maxx"], $mapExt["maxy"]);
         $mapProjStr = $map->getProjection();
         $layerProjStr = $qLayer->getProjection();
         if ($mapProjStr != $layerProjStr) {
             if ($_SESSION['MS_VERSION'] < 6) {
                 $mapProjObj = ms_newprojectionobj($mapProjStr);
                 $layerProjObj = ms_newprojectionobj($layerProjStr);
             } else {
                 $mapProjObj = new projectionObj($mapProjStr);
                 $layerProjObj = new projectionObj($layerProjStr);
             }
             $me->project($mapProjObj, $layerProjObj);
         }
         //##error_log($qLayer->name . " - minx: $me->minx - miny: $me->miny - maxx: $me->maxx - maxy: $me->maxy");
         $qLayer->open();
         $status = $qLayer->whichShapes($me);
         $classList = array();
         while ($shape = $qLayer->nextShape()) {
             $shpIdx = $shape->index;
             $clsIdx = $qLayer->getClassIndex($shape);
             //error_log("$shpIdx: $clsIdx");
             if (!in_array($clsIdx, $classList) && $clsIdx >= 0) {
                 $classList[] = $clsIdx;
             }
         }
         $qLayer->close();
         unset($me);
         //error_log(implode(",", $classList));
         if (count($classList) > 0) {
             return $classList;
         } else {
             return 0;
         }
     }
 }
Exemplo n.º 3
0
 public function returnXYGeoDimensions()
 {
     //$initExtent = $this->map->extent;
     if (isset($_SESSION['mapMaxExt'])) {
         $me = $_SESSION['mapMaxExt'];
         $initExtent = ms_newrectObj();
         $initExtent->setExtent($me["minx"], $me["miny"], $me["maxx"], $me["maxy"]);
     } else {
         $initExtent = $this->map->extent;
     }
     $dgeo['x'] = $initExtent->maxx - $initExtent->minx;
     $dgeo['y'] = $initExtent->maxy - $initExtent->miny;
     $dgeo['c'] = $this->map->units == 5 ? 111120 : 1;
     return $dgeo;
 }
Exemplo n.º 4
0
 /**
  * EXECUTE QUERY
  */
 function q_execMapQuery()
 {
     // use layers with complex queries that are too long to select results
     // cause maxscaledenom is not used...
     $oldDatas = array();
     for ($i = 0; $i < $this->map->numlayers; $i++) {
         $qLayer = $this->map->getLayer($i);
         if ($qLayer->getMetaData('PM_RESULT_DATASUBSTITION') != '') {
             $oldDatas[$i] = $qLayer->data;
             $qLayer->set('data', $qLayer->getMetaData('PM_RESULT_DATASUBSTITION'));
         }
     }
     // Patch from Alessandro Pasotti for fixing problems with result returned
     $this->map->setSize($this->mapwidth, $this->mapheight);
     // Set $this->map->extent to values of current map extent
     // otherwise values of TOLERANCE in map file are not interpreted correctly
     $this->map->setExtent($this->GEOEXT['minx'], $this->GEOEXT['miny'], $this->GEOEXT['maxx'], $this->GEOEXT['maxy']);
     $this->map->preparequery();
     // query by point
     if (count($this->imgxy_arr) == 2) {
         $this->pointQuery = 1;
         $this->x_pix = $this->imgxy_arr[0];
         $this->y_pix = $this->imgxy_arr[1];
         $x_geo = $this->minx_geo + $this->x_pix / $this->mapwidth * $this->xdelta_geo;
         $y_geo = $this->maxy_geo - $this->y_pix / $this->mapheight * $this->ydelta_geo;
         $XY_geo = ms_newPointObj();
         $XY_geo->setXY($x_geo, $y_geo);
         $searchArea = -1;
         // ===> USE TOLERANCE IN MAP FILE FOR EACH LAYER <===
         // Use '@' to avoid warning if query found nothing
         $qtype = $this->mode != "iquery" ? MS_MULTIPLE : MS_SINGLE;
         // MS_MULTIPLE for normal query, MS_SINGLE for iquery
         @$this->map->queryByPoint($XY_geo, $qtype, $searchArea);
         PMCommon::freeMsObj($XY_geo);
         // query by Rectangle
     } else {
         $this->pointQuery = 0;
         $minx_pix = $this->imgxy_arr[0];
         $miny_pix = $this->imgxy_arr[1];
         $maxx_pix = $this->imgxy_arr[2];
         $maxy_pix = $this->imgxy_arr[3];
         if ($minx_pix == $maxx_pix) {
             $maxx_pix = $maxx_pix + 2;
         }
         // increase max extent if min==max
         if ($miny_pix == $maxy_pix) {
             $maxy_pix = $maxy_pix - 2;
         }
         // -- " --
         $this->minx_sel_geo = $this->minx_geo + $minx_pix / $this->mapwidth * $this->xdelta_geo;
         $this->miny_sel_geo = $this->maxy_geo - $maxy_pix / $this->mapheight * $this->ydelta_geo;
         $this->maxx_sel_geo = $this->minx_geo + $maxx_pix / $this->mapwidth * $this->xdelta_geo;
         $this->maxy_sel_geo = $this->maxy_geo - $miny_pix / $this->mapheight * $this->ydelta_geo;
         $selrect = ms_newrectObj();
         $selrect->setExtent($this->minx_sel_geo, $this->miny_sel_geo, $this->maxx_sel_geo, $this->maxy_sel_geo);
         @$this->map->queryByRect($selrect);
         PMCommon::freeMsObj($selrect);
         //$queryFile = "d:/webdoc/tmp/qresults.txt";
         //$savedq = $this->map->savequery($queryFile);
         //printDebug($this->map->loadquery($queryFile));
         //error_log(
     }
     // use layers with complex queries that are too long to select results
     // cause maxscaledenom is not used...
     // reset data tag
     if (count($oldDatas)) {
         foreach ($oldDatas as $i => $v) {
             $qLayer = $this->map->getLayer($i);
             $qLayer->set('data', $v);
         }
     }
 }
Exemplo n.º 5
0
        //set view extents
        for ($view_count = 1; $view_count < $counter + 1; $view_count++) {
            if ($_REQUEST['view'] == $view_name[$view_count]) {
                // $view=$_REQUEST['view'];
                $j = $view_count;
                $view_minx = $view_values[$j][0];
                $view_miny = $view_values[$j][1];
                $view_maxx = $view_values[$j][2];
                $view_maxy = $view_values[$j][3];
                $my_extent = ms_newrectObj();
                $my_extent->setextent($view_minx, $view_miny, $view_maxx, $view_maxy);
                $view = $_REQUEST['view'];
            }
        }
    } else {
        $my_extent = ms_newrectObj();
        $my_extent->setextent($map->extent->minx, $map->extent->miny, $map->extent->maxx, $map->extent->maxy);
    }
}
$query = FALSE;
if (isset($_REQUEST['zoom'])) {
    $zoom = $_REQUEST['zoom'];
    $my_point = ms_newpointObj();
    if (isset($_REQUEST['x']) && isset($_REQUEST['y']) && $zoom != 0) {
        if (isset($_REQUEST['oldsize'])) {
            $my_point->setXY(floor($_REQUEST['x'] * $size / $_REQUEST['oldsize']), floor($_REQUEST['y'] * $size / $_REQUEST['oldsize']));
        } else {
            $my_point->setXY(floor($_REQUEST['x']), floor($_REQUEST['y']));
        }
    } else {
        $my_point->setXY($map->width / 2, $map->height / 2);
Exemplo n.º 6
0
 /**
  * ZOOM MAP TO SPECIFIED SCALE
  */
 function zoom2scale()
 {
     $GEOEXT = $_SESSION["GEOEXT"];
     $geoext0 = ms_newrectObj();
     $geoext0->setExtent($GEOEXT["minx"], $GEOEXT["miny"], $GEOEXT["maxx"], $GEOEXT["maxy"]);
     // PREPARE MAP IMG
     $x_pix = $this->mapW / 2;
     $y_pix = $this->mapH / 2;
     $xy_pix = ms_newPointObj();
     $xy_pix->setXY($x_pix, $y_pix);
     $this->map->zoomscale($this->scale, $xy_pix, $this->mapW, $this->mapH, $geoext0);
     PMCommon::freeMsObj($xy_pix);
 }
Exemplo n.º 7
0
Arquivo: map.php Projeto: sukma279/GIS
 /**
  * Set map maximum extent
  * takes values from session if set via URL (in initmap()->getMapInitURL())
  */
 public function getMapMaxExtent()
 {
     if (isset($_SESSION['mapMaxExt'])) {
         $me = $_SESSION['mapMaxExt'];
         $mapMaxExt = ms_newrectObj();
         $mapMaxExt->setExtent($me["minx"], $me["miny"], $me["maxx"], $me["maxy"]);
     } else {
         $mapMaxExt = $this->map->extent;
     }
     return $mapMaxExt;
 }
Exemplo n.º 8
0
function map_redraw($mapfile, $corx, $cory, $minx, $maxx, $miny, $maxy, $xsize, $ysize, $layers, $labels, $zoom, $changeleg = false, $corx2 = 0, $cory2 = 0)
{
    global $prefs;
    $objResponse = new xajaxResponse();
    if (strstr($mapfile, '..')) {
        $msg = tra("You do not have permission to do that");
        $objResponse->addAlert($msg);
        return $objResponse;
    }
    $prefs['map_path'] = preg_replace("/\\/?\$/", "/", $prefs['map_path']);
    //checking the mapfile
    if (!is_file($prefs['map_path'] . $mapfile) || preg_match("/(\\/\\.)/", $prefs['map_path'] . $mapfile)) {
        $msg = tra("invalid mapfile name");
        $objResponse->addAlert($msg);
        return $objResponse;
    }
    $map = ms_newMapObj($prefs['map_path'] . $mapfile);
    for ($j = 0; $j < $map->numlayers; $j++) {
        $my_layer = $map->getLayer($j);
        if ($layers[$j] == "true") {
            $my_layer->set("status", MS_ON);
        } else {
            $my_layer->set("status", MS_OFF);
        }
        if ($labels[$j] == "false") {
            $my_layer->set("labelmaxscale", 0);
        }
    }
    $map->Set("width", $xsize);
    $map->Set("height", $ysize);
    $my_point = ms_newpointObj();
    if ($zoom == 3) {
        $my_point->setXY($map->width / 2, $map->height / 2);
    } else {
        $my_point->setXY(floor($corx), floor($cory));
    }
    $my_extent = ms_newrectObj();
    $my_extent->setextent($minx, $miny, $maxx, $maxy);
    $result = "";
    if ($zoom == 3) {
        $map->zoompoint(1, $my_point, $map->width, $map->height, $my_extent);
        $result = map_query($map, $corx, $cory);
    } elseif ($zoom == 5) {
        $my_rect = ms_newrectObj();
        $my_rect->setextent($corx, $cory, $corx2, $cory2);
        $map->zoomrectangle($my_rect, $map->width, $map->height, $my_extent);
        $objResponse->addAssign("minx", "value", $map->extent->minx);
        $objResponse->addAssign("miny", "value", $map->extent->miny);
        $objResponse->addAssign("maxx", "value", $map->extent->maxx);
        $objResponse->addAssign("maxy", "value", $map->extent->maxy);
        $objResponse->addAssign("map", "style.cursor", "default");
        $objResponse->addAssign("zoomselect", "style.visibility", "hidden");
        $objResponse->addScript("xMoveTo(xGetElementById('map'),0,0);");
        $objResponse->addScript("minx=" . $map->extent->minx . ";");
        $objResponse->addScript("miny=" . $map->extent->miny . ";");
        $objResponse->addScript("maxx=" . $map->extent->maxx . ";");
        $objResponse->addScript("maxy=" . $map->extent->maxy . ";");
    } else {
        $map->zoompoint(1, $my_point, $map->width, $map->height, $my_extent);
        $objResponse->addAssign("minx", "value", $map->extent->minx);
        $objResponse->addAssign("miny", "value", $map->extent->miny);
        $objResponse->addAssign("maxx", "value", $map->extent->maxx);
        $objResponse->addAssign("maxy", "value", $map->extent->maxy);
        $objResponse->addAssign("map", "style.cursor", "move");
        $objResponse->addScript("xMoveTo(xGetElementById('map'),0,0);");
        $objResponse->addScript("minx=" . $map->extent->minx . ";");
        $objResponse->addScript("miny=" . $map->extent->miny . ";");
        $objResponse->addScript("maxx=" . $map->extent->maxx . ";");
        $objResponse->addScript("maxy=" . $map->extent->maxy . ";");
    }
    $image = $map->drawquery();
    $image_url = $image->saveWebImage();
    if ($zoom != 3) {
        $image_ref = $map->drawReferenceMap();
        $image_ref_url = $image_ref->saveWebImage();
        $image_ref->free();
    }
    if ($changeleg) {
        $image_leg = $map->drawLegend();
        $image_leg_url = $image_leg->saveWebImage();
        $image_leg->free();
    }
    if ($zoom == 2 || $zoom == 5) {
        $image_scale = $map->drawScaleBar();
        $image_scale_url = $image_scale->saveWebImage();
        $image_scale->free();
    }
    $image->free();
    $objResponse->addAssign("innerBoxContent", "innerHTML", $result);
    $objResponse->addAssign("resultBox", "innerHTML", $result);
    $objResponse->addAssign("map", "src", $image_url);
    if ($zoom != 3) {
        $objResponse->addAssign("ref", "src", $image_ref_url);
    }
    if ($zoom == 2 || $zoom == 5) {
        $objResponse->addAssign("scale", "src", $image_scale_url);
    }
    if ($changeleg) {
        $objResponse->addAssign("leg", "src", $image_leg_url);
    }
    return $objResponse;
}
Exemplo n.º 9
0
 public static function calculateExtent($map, $groups, $applyMapExtentIfNull = false, $addBuffer = false)
 {
     $mapExtent = ms_newrectObj();
     $layers = getLayersByGroupOrLayerName($map, $groups);
     foreach ($layers as $layer) {
         $layerExtent = false;
         if ($layer) {
             if ($layer->connectiontype == MS_POSTGIS || $layer->connectiontype == MS_ORACLESPATIAL) {
                 //get dns string containing : type of database, user name, password, host and database.
                 $dsn = PluginsMapUtils::getDSNConnection($layer);
                 if ($dsn) {
                     // code from mapserver mailing list (by Armin Burger):
                     // get table and filter :
                     $data = PluginsMapUtils::getQueryParamsFromDataString($layer, false, false);
                     $mapLayerFilter = $data['mapLayerFilter'];
                     $fromTable = $data['fromTable'];
                     $geomFld = $data['geomFld'];
                     $sql = 'SELECT ST_xmin(extent) AS minx, ST_ymin(extent) AS miny, ST_xmax(extent) AS maxx, ST_ymax(extent) AS maxy ';
                     $sql .= "FROM (SELECT St_Extent({$geomFld}) AS extent FROM {$fromTable} ";
                     $sql .= ($mapLayerFilter ? "WHERE {$mapLayerFilter}" : '') . ' ';
                     $sql .= ') AS bar';
                     $sql .= ' WHERE extent IS NOT NULL';
                     pm_logDebug(4, "calculateExtent - sql:{$sql}");
                     // DB:
                     require_once dirname(__FILE__) . '/easyMDB2.inc.php';
                     $edb = new Easy_MDB2();
                     $edb->setDSN($dsn);
                     $edb->start();
                     $qresultE = $edb->selectByQuery($sql, '');
                     $resValues = $qresultE['values'][0];
                     if ($resValues) {
                         $resIsValid = true;
                         foreach ($resValues as $val) {
                             if (!isset($val) || $val == 0 || $val == -1) {
                                 $resIsValid = false;
                                 break;
                             }
                         }
                         if ($resIsValid) {
                             $layerExtent = ms_newRectObj();
                             $layerExtent->setExtent($resValues['minx'], $resValues['miny'], $resValues['maxx'], $resValues['maxy']);
                         }
                     }
                 }
             } else {
                 if ($layer->type != MS_LAYER_RASTER && ($layer->connectiontype == MS_SHAPEFILE || $layer->connectiontype == MS_TILED_SHAPEFILE || $layer->connectiontype == MS_OGR)) {
                     // SHP layer, OGR layer
                     $layerExtent = @$layer->getExtent();
                 }
             }
             if ($layerExtent) {
                 // change projection
                 $mapProjStr = $map->getProjection();
                 $layerProjStr = $layer->getProjection();
                 if ($mapProjStr && $layerProjStr && $mapProjStr != $layerProjStr) {
                     if ($_SESSION['MS_VERSION'] < 6) {
                         $mapProjObj = ms_newprojectionobj($mapProjStr);
                         $layerProjObj = ms_newprojectionobj($layerProjStr);
                     } else {
                         $mapProjObj = new projectionObj($mapProjStr);
                         $layerProjObj = new projectionObj($layerProjStr);
                     }
                     $layerExtent->project($layerProjObj, $mapProjObj);
                 }
                 // add buffer around freshly calculated extent
                 if ($addBuffer) {
                     $minx = $layerExtent->minx;
                     $miny = $layerExtent->miny;
                     $maxx = $layerExtent->maxx;
                     $maxy = $layerExtent->maxy;
                     $pointBuffer = isset($_SESSION['pointBuffer']) ? $_SESSION['pointBuffer'] : 50;
                     $shapeQueryBuffer = isset($_SESSION['shapeQueryBuffer']) ? $_SESSION['shapeQueryBuffer'] : 0.01;
                     $buf = 0;
                     if ($layer->type == MS_LAYER_POINT || $layer->type == MS_LAYER_ANNOTATION) {
                         $buf = $pointBuffer;
                         // set buffer depending on dimensions of your coordinate system
                     } else {
                         if (isset($shapeQueryBuffer) && $shapeQueryBuffer > 0) {
                             $buf = $shapeQueryBuffer * (($maxx - $minx + ($maxy - $miny)) / 2);
                         }
                     }
                     if ($buf > 0) {
                         $minx -= $buf;
                         $miny -= $buf;
                         $maxx += $buf;
                         $maxy += $buf;
                         $layerExtent->setExtent($minx, $miny, $maxx, $maxy);
                     }
                 }
                 if ($mapExtent->minx == -1 && $mapExtent->miny == -1 && $mapExtent->maxx == -1 && $mapExtent->maxy == -1) {
                     $minx = $layerExtent->minx;
                     $miny = $layerExtent->miny;
                     $maxx = $layerExtent->maxx;
                     $maxy = $layerExtent->maxy;
                 } else {
                     $minx = $layerExtent->minx < $mapExtent->minx ? $layerExtent->minx : $mapExtent->minx;
                     $miny = $layerExtent->miny < $mapExtent->miny ? $layerExtent->miny : $mapExtent->miny;
                     $maxx = $layerExtent->maxx > $mapExtent->maxx ? $layerExtent->maxx : $mapExtent->maxx;
                     $maxy = $layerExtent->maxy > $mapExtent->maxy ? $layerExtent->maxy : $mapExtent->maxy;
                 }
                 $mapExtent->setExtent($minx, $miny, $maxx, $maxy);
             }
         }
     }
     if ($mapExtent->minx == -1 || $mapExtent->miny == -1 || $mapExtent->maxx == -1 || $mapExtent->maxy == -1) {
         $mapExtent = $map->extent;
         if (!$applyMapExtentIfNull) {
             $mapExtent->setExtent(0, 0, 1, 1);
         }
     }
     return $mapExtent;
 }