[mapserver-users] PHP MapScript: shape->classindex is always 0
Peter Hopfgartner
peter.hopfgartner at r3-gis.com
Wed Mar 24 03:38:49 PDT 2010
Hello
As I interpreted this, classindex should point to the right class of the
instantiated shape. Unfortunatly, classindex is always 0.
As a test I have a LAYER with 2 classes,
CLASS
NAME 'class1'
EXPRESSION (([class] eq 1))
STYLE
SYMBOL "circle"
SIZE 7.0
OUTLINECOLOR 0 0 0
COLOR 0 128 0
END
END
CLASS
NAME 'class2'
EXPRESSION (([class] eq 2))
STYLE
SYMBOL "circle"
SIZE 7.0
OUTLINECOLOR 0 0 0
COLOR 0 0 128
END
END
In the PostGIS database are 4 point, 2 with class=1 and 2 with class=2,
the generated map image shows the expected colors.
The following script:
<?php
$mapfile = 'test.map';
$map = ms_newmapobj($mapfile);
$layer = $map->getLayerByName('test');
$status = $layer->open();
$status = $layer->whichShapes($map->extent);
while ($shape = $layer->nextShape())
{
echo "index: {$shape->index}\tclassindex: {$shape->classindex}\n";
}
$layer->close();
?>
the following output:
index: 0 classindex: 0
index: 1 classindex: 0
index: 2 classindex: 0
index: 3 classindex: 0
which is not what I expected.
Am I missing something obvious or is this a MapServer bug?
Regards,
Peter
--
Dott. Peter Hopfgartner
R3 GIS Srl - GmbH
Via Johann Kravogl-Str. 2
I-39012 Meran/Merano (BZ)
Email: peter.hopfgartner at r3-gis.com
Tel. : +39 0473 494949
Fax : +39 0473 069902
www : http://www.r3-gis.com
XING : http://www.xing.com/go/invita/8917535
More information about the MapServer-users
mailing list