[Mapserver-users] Saving Extents

Rene Teniere TENIERER at gov.ns.ca
Fri Feb 27 09:12:12 PST 2004


Hi All,

I've been working on this all day and I can't seem to be able to retain
my map extents set through setExtent(). I've tried setting hidden
variables, and I can still only get the original extents. Here is an
example of what I did:

within the phtml page after the extent has been set:
</td>
<?php
  echo ('<INPUT TYPE=HIDDEN NAME=minx
VALUE="'.$map->extent->minx.'">');
  echo ('<INPUT TYPE=HIDDEN NAME=miny
VALUE="'.$map->extent->miny.'">');
  echo ('<INPUT TYPE=HIDDEN NAME=maxx
VALUE="'.$map->extent->maxx.'">');
  echo ('<INPUT TYPE=HIDDEN NAME=maxy
VALUE="'.$map->extent->maxy.'">');
  echo ('<INPUT TYPE=HIDDEN NAME=imagewidth
VALUE="'.$map->width.'">');
  echo ('<INPUT TYPE=HIDDEN NAME=imageheight
VALUE="'.$map->height.'">');
?>
</form>

in the included .php script:
//Get Current Extents
if($_POST["minx"])
{
  $dfMinX = doubleval($_POST["minx"]);
  $dfMinY = doubleval($_POST["miny"]);
  $dfMaxX = doubleval($_POST["maxx"]); 
  $dfMaxY = doubleval($_POST["maxy"]);
//  $map->setExtent($dfMinX,$dfMinY,$dfMaxX,$dfMaxY);
  error_log("First: ".$dfMinX." ".$dfMinY." ".$dfMaxX." ".$dfMaxY);
  }

also within the phtml page after the extent has been set:
</td>
<?php
  //Get Extents
  $rtMinX = $map->extent->minx;
  $rtMinY = $map->extent->miny;
  $rtMaxX = $map->extent->maxx;
  $rtMaxY = $map->extent->maxy;
  rtExtents($rtMinX,$rtMinY,$rtMaxX,$rtMaxY);
?>
</form>

in the included .php script:
function rtExtents($rtMinX,$rtMinY,$rtMaxX,$rtMaxY)
{
  //$map->setExtent($$rtMinX,$rtMinY,$rtMaxX,$rtMaxY);
  error_log("Second: ".$rtMinX." ".$rtMinY." ".$rtMaxX." ".$rtMaxY);
}

Rene



More information about the MapServer-users mailing list