[mapserver-users] PHP MapScript: shape->classindex is always 0

Peter Hopfgartner peter.hopfgartner at r3-gis.com
Thu Mar 25 07:41:55 PDT 2010


Hi Alan

Thynk you for your support!

I've files http://trac.osgeo.org/mapserver/ticket/3406 and attached all 
files necessary to reproduce the problem. Due to the current slowness of 
the OsGeo the bug is filed twice, I've marked 3404 as a duplicate, sorry 
for the annoyance.

Regards,

Peter

Alan Boudreault wrote:
> Hi Peter,
>
> If you are sure that the shape use the different classes you specified in the 
> mapfile (you probably see it in your map image), so I guess it could be a bug. 
> Please fill a ticket with a test case. Assign it to "aboudreault". 
>
> regards,
> Alan
>
> On March 24, 2010 06:38:49 am Peter Hopfgartner wrote:
>   
>> 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