Getting field values from a point using mapscript
Paulo Alves
johnny.alves at GMAIL.COM
Tue Aug 1 12:24:00 PDT 2006
Hello! I'm using ms4w under winxp. I want to get information about a point
and show it in a popup.
here is a part of my code:
$image=$map->draw();
$image_url=$image->saveWebImage();
$extent_to_html = $map->extent->minx." ".$map->extent->miny." "
.$map->extent->maxx." ".$map->extent->maxy;
$my_point = ms_newpointObj();
$my_point->setXY($_REQUEST["mapa_x"],$_REQUEST["mapa_y"]);
/* if we are selecting a click */
if ( isset($_REQUEST["zoom"]) && $_REQUEST["zoom"]=="query") {
$dfKeyMapXMin = $map->extent->minx;
$dfKeyMapYMin = $map->extent->miny;
$dfKeyMapXMax = $map->extent->maxx;
$dfKeyMapYMax = $map->extent->maxy;
$dfWidthPix = doubleval($image->width);
$dfHeightPix = doubleval($image->height);
$nClickGeoX = GMapPix2Geo($_REQUEST['mapa_x'], 0, $dfWidthPix,
$dfKeyMapXMin,
$dfKeyMapXMax, 0);
$nClickGeoY = GMapPix2Geo($_REQUEST["mapa_y"], 0, $dfHeightPix,
$dfKeyMapYMin,
$dfKeyMapYMax, 1);
$my_point = ms_newpointObj();
$my_point->setXY($nClickGeoX,$nClickGeoY);
$uLayer->queryByPoint($my_point, MS_SINGLE, 200);
$results = $uLayer->{resultcache};
$rslt = $uLayer->getResult(0);
$database_id2 = $rslt->{shapeindex};
echo $database_id;
echo $database_id2;
$foo = $uLayer->{numresults};
echo $foo;
// always -1
exit;
}
I receive the shapeindex of the point correctly, but how i can get the
value of the fields and show it in a new window?
Thanks...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060801/7d75bc5a/attachment.htm>
More information about the MapServer-users
mailing list