[mapserver-users] queries
Grégory Huchon
gregory_huchon at yahoo.fr
Thu May 31 06:53:53 PDT 2001
We are working at Reunion Island. We are starting in
using Mapserver.
These are my problems :
I have about 20 layers in my Mapfile. I would like to
query all these layers.
When I click on the map I don't get all the
informations. For example : I get only 4 results among
8.
All the queries work.
When I move in my mapfile a layer which showed no
results (which is for example number 25 )to the top
(for example number 5) , I get the results.
Can you help me ?
Sorry for my english
Thank you for your help
I give you the php function :
function GMapDumpQueryResults()
{
GLOBAL $gpoMap, $gpoQueryResults;
if (! $gpoQueryResults )
{
printf(" ");
return;
}
printf("<TABLE>\n");
printf("NumResults = %d, NumQueryLayers = %d\n",
$gpoQueryResults->numresults,
$gpoQueryResults->numquerylayers);
$iCurLayer = -1;
$aFields = "";
$gpoQueryResults->rewind();
for($iRes=0; $iRes < $gpoQueryResults->numresults;
$iRes++)
{
$oResult = $gpoQueryResults->next();
//echo "[$oResult - $iRes]";
if ($oResult->layer == -1)
break;
if ($iCurLayer != $oResult->layer)
{
$iCurLayer = $oResult->layer;
echo "**$iCurLayer**";
$oLayer = $gpoMap->GetLayer($iCurLayer);
$dbfname = $gpoMap->shapepath . "/".
$oLayer->data . ".dbf";
echo "<br>Fichier dbf: $dbfname - $oLayer -
$iCurLayer<br>";
if ($db)
dbase_close($db);
$db = dbase_open($dbfname, 0);
$selFields = explode(" ",
$oLayer->header);
if ($iCurLayer != -1)
printf("</TABLE>\n");
printf("<TABLE BORDER=0 CELLSPACING=1
CELLPADDING=2 WIDTH=100%%>\n");
printf("<TD COLSPAN=%d BGCOLOR=#C1D8E3>",
sizeof($selFields));
printf("<CENTER> %s </CENTER>", $oLayer->group);
printf("</TR>\n");
printf("<TD COLSPAN=%d BGCOLOR=#C1D8E3>",
sizeof($selFields));
printf("<CENTER> %s </CENTER>",
$oLayer->description);
printf("</TR>\n");
/* name of the attributes. */
printf("<TR>\n");
for ($iField=0; $iField < sizeof($selFields);
$iField++)
{
printf("<TD BGCOLOR=#E2EFF5>");
printf("%s",$selFields[$iField]);
printf("</TD>");
}
printf("</TR>\n");
}
$rec = dbase_get_record_with_names($db,
$oResult->shape+1);
printf("<TR>\n");
//echo ">> ";
//printf("%s",trim($rec[strtoupper(nom_alea[0])]));
//echo " <<";
for($iField=0; $iField < sizeof($selFields);
$iField++)
{
printf("<TD BGCOLOR=#FFFFFF>");
printf("%s",trim($rec[strtoupper($selFields[$iField])]));
echo "<br>
trim(\$rec[strtoupper($selFields[$iField])]) <br>";
//--- variable: %s
printf("</TD>");
}
printf("</TR>\n");
}
if ($db)
dbase_close($db);
printf("</TABLE>\n");
___________________________________________________________
Do You Yahoo!? -- Pour faire vos courses sur le Net,
Yahoo! Shopping : http://fr.shopping.yahoo.com
More information about the MapServer-users
mailing list