[mapserver-users] PHP MapScript: shape->classindex is always 0
Peter Hopfgartner
peter.hopfgartner at r3-gis.com
Thu Mar 25 07:44:36 PDT 2010
Hi Josh,
this is funny! I've hit this bug while working on a KML export, too.
I've extracted a minimal test and it is attached to
http://trac.osgeo.org/mapserver/ticket/3406.
Regards,
Peter
Josh Hevenor wrote:
> I think I came across the same thing, or something related, when I was
> trying to generate KML using mapserver templates. I know I ended up
> recreating the class expression in my output instead of using the
> [shpclass] variable. Let me know if a bug is filed and I'll work up an
> example to submit. (mapserver 5.2)
>
> Josh
>
> 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
>>>
>>>
>>>
>>
>> ------------------------------------------------------------------------
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG - www.avg.com
>> Version: 8.5.437 / Virus Database: 271.1.1/2769 - Release Date: 03/25/10 07:33:00
>>
>>
>>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
--
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