[mapserver-users] getLayer dies without error, php mapscript
Robert Burgholzer
rburghol at vt.edu
Sun Apr 28 11:03:35 PDT 2002
Hello,
I am trying to retrieve and work on a shape from a layer (see code below
and map files snippet). All works well with my map, including showing
the map, and verifying that I can grab layers objects, etc. When I try
to retrieve a shape from a layer though, my script dies without warning.
I know that the layer 'microhup' exists in my map, and I know that it
has 125 data lines, which I assume are shapes (microhup is an esri
polygon shape file, with all of its subordinate files, .dbf, .shx,
etc.), and I also know that the column "ID" exists in this file. In the
code below, I have queried for record 1 (see getShape(-1,1), it is an
untiled layer), to see if I can view its props. Can anyone tell me what
I am missing, or point me to something which might explain teh process
of retrieving individual shapes from a layer?
<start php mapscript snippet.... >
$map = ms_newMapObj($map_path.$map_file);
$lname = "microhup";
$thislayer = $map->getLayerByName($lname);
$lci = $thislayer->classitem;
$data = $thislayer->data;
$res = $thislayer->getShape(-1,1);
$reso = $res->type;
$resi = $res->values["ID"];
print("$reso: $resi,");
$res->free();
<... edn php mapscript snippet>
<start map file snip>
LAYER
NAME microhup
TYPE POLYGON
STATUS ON
DATA microhup
FILTER "1 = 1"
TOLERANCE 10
CLASS
TEMPLATE void
COLOR -1 -1 -1
OUTLINECOLOR 200 200 200
#EXPRESSION ([ID] <= 20)
END
END
<... end map file snip>
--
Robert Burgholzer
al·go·rithm n.
A step-by-step problem-solving procedure, especially an
established, recursive computational
procedure for solving a problem in a finite number of steps.
Invented by Al Gore.
rburghol at vt.edu
http://www.soulswimmer.net/
More information about the MapServer-users
mailing list