[mapserver-users] small query problem PHP

Jim Burnett jimburnett at ntelos.net
Mon Oct 29 12:30:42 PST 2001


I am using this function for selecting, and highlighting parcels, however when I do select a parcel, the hole map seems to shift down, and to the right a little. Not sure who wrote this function though. Any sugestions?


php_mapscript
2 month old build of mapserver_nightly

-jb-


 session_start();
  dl("php_mapscript.so");

require 'config.php';
$dfMinX = $CUREXTENT[minx];
  $dfMinY = $CUREXTENT[miny];
   $dfMaxX = $CUREXTENT[maxx];
    $dfMaxY = $CUREXTENT[maxy];


$mapObj = ms_newMapObj("$mapfilePath/$mapfile.map");

######Loop through to display checkboxes for layers, loop the lay_name array and lay_stats arrays###
 for ($i = 0; $i <= ( count ($lay_name_array) -1 ); $i++) {
  $layerObj = $mapObj->getLayerByName($lay_name_array[$i]);
  $layerObj->set("status",$lay_status_array[$i]);
  #$layerObj->free();
 }
######END#####################################################


  $mapObj->setExtent($CUREXTENT[minx],$CUREXTENT[miny],$CUREXTENT[maxx],$CUREXTENT[maxy]);
   $nClickGeoX = GMapPix2Geo(intval($map_x), 0, $width, $dfMinX, $dfMaxX, 0);
    $nClickGeoY = GMapPix2Geo(intval($map_y), 0, $height, $dfMinY, $dfMaxY, 1);
     $ptClicked = ms_newPointObj();
      $ptClicked->setXY($nClickGeoX, $nClickGeoY);
       $queryObj = $mapObj->queryByPoint( $ptClicked,MS_SINGLE,0 );
        $gbShowQueryResults = TRUE;
#print" $map $map_x $map_y $dataPath \n";

$img = $mapObj->drawQuery();

header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("content-type: image/png");
$img->saveImage("",MS_PNG,0,0, 100);




function GMapPix2Geo($nPixPos, $dfPixMin, $dfPixMax, $dfGeoMin, $dfGeoMax, $nInversePix)
 {
    $dfWidthGeo = $dfGeoMax - $dfGeoMin;
    $dfWidthPix = $dfPixMax - $dfPixMin;
    $dfPixToGeo = $dfWidthGeo / $dfWidthPix;
    if (!$nInversePix)
        $dfDeltaPix = $nPixPos - $dfPixMin;
    else
        $dfDeltaPix = $dfPixMax - $nPixPos;
    $dfDeltaGeo = $dfDeltaPix * $dfPixToGeo;
    $dfPosGeo = $dfGeoMin + $dfDeltaGeo;
    return ($dfPosGeo);
 }



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20011029/3cc3cdba/attachment.htm>


More information about the MapServer-users mailing list