[Mapserver-users] Problem with Mascript ShapeObj.values array
Stefano Bonnin
shpr at libero.it
Thu Oct 2 01:46:59 PDT 2003
Hi,
I'm trying to get information from Postgis with PHPMapscript
This is my layer definition:
LAYER
NAME "Percolato"
METADATA
"LYRNAME" "Percolato"
"DESCRIPTION" "P.O.I2"
"TABLE" "edtlyr_percolato_1"
"QUERY_FIELDS" "gid,name,value,type"
"RESULT_FIELDS" "Nome,ID,Tipo"
END
GROUP "P.O.I"
STATUS ON
DATA "the_geom from edtlyr_percolato_1"
TYPE point
CONNECTIONTYPE POSTGIS
CONNECTION "user=user dbname=dbname"
MAXSCALE 7000
MINSCALE 0
LABELITEM "name"
LABELMAXSCALE 3500
CLASSITEM "type"
CLASS
CLASS
NAME "a"
EXPRESSION 'a'
SYMBOL "prelievoperco"
COLOR 255 255 255
SIZE 15
TEMPLATE "blank.html"
LABEL
BACKGROUNDCOLOR 0 0 0
FONT "arial"
TYPE TRUETYPE
POSITION lc
MINSIZE 10
MAXSIZE 25
COLOR 255 255 255
BACKGROUNDSHADOWCOLOR 128 128 128
ANTIALIAS true
END
END
END
And this is my PHPMapscript code (It can be wrong because I have extracted
some line with cut and past):
.....
.....
$oLayer = $gpoMap->GetLayer($iLayer);
$numResults = $oLayer->getNumResults();
$oLayer->open();
$resultFields = explode(",", $oLayer->getMetaData("RESULT_FIELDS"));
for ($iRes=0; $iRes < $numResults; $iRes++) {
$oRes = $oLayer->getResult($iRes);
$oShape = $oLayer->getShape($oRes->tileindex,$oRes->shapeindex);
fwrite($fp, "<TR>\n");
for($iField=0; $iField < sizeof($queryFields); $iField++) {
if ($queryFields[$iField] == 'gid') {
$gid =
$oShape->values[$queryFields[$iField]];
}
else if ($queryFields[$iField] == 'name') {
$pname =
$oShape->values[$queryFields[$iField]];
}
else if ($queryFields[$iField] == 'type') {
$pname =
$oShape->values[$queryFields[$iField]];
}
else if ($queryFields[$iField] == "value") {
$vl =
$oShape->values[$queryFields[$iField]];
}
}
}
......
......
The tree first variables $gid, $pname and $vl has a correct value
BUT
the last one ($vl) has NO VALUE.
The $oShape->values length is 3.
Why the array length is only 3?
My postgres table has the following attributes: "the_geom", "value","type",
"name" and "gid".
Thanks in advance.
---
Outgoing mail is certified Virus Free. (FLASHH!)
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.522 / Virus Database: 320 - Release Date: 29/09/03
More information about the MapServer-users
mailing list