Display of Symbols using mapscript

Matthew Cross1 MattCross at UK.IBM.COM
Wed Sep 6 07:20:49 EDT 2006


Hello there,

My first time on the list and I wonder if someone could answer this 
question.

We have a java (v1.4.2) mapscript application built on MS4W 1.5.1 with 
Mapserver 4.8.3. We are trying to display symbolised points. The 
application populates a mapObj and then draws an output file in PNG 
format. Our problem is that the PNG image does not show the selected 
symbol but simply displays a coloured pixel. However, if we load the map 
file which was created by a .save call into a browser then the symbol is 
displayed correctly.

Our code is as follows:

        mapObj map = new mapObj(null);
        map.setStatus(mapscriptConstants.MS_ON);
        map.setName("JustDrawMe");
        map.setProjection("init=epsg:27700");
        map.setSymbolSet("/PATH/symLib.sym");
        map.setFontSet("/PATH/fonts.txt"); 

        //Create layer
        layerObj layer2 = new layerObj(map);
        layer2.setName("TEST_POINT");
        layer2.setType(MS_LAYER_TYPE.MS_LAYER_POINT);
        layer2.setStatus(mapscriptConstants.MS_ON);
        layer2.setTransform(0);

        //Add Point
        shapeObj shapePt = new shapeObj(0);
        lineObj line2 = new lineObj();
        line2.add(new pointObj(150,150,0));
        shapePt.add(line2);
        shapePt.setType(1);
        layer2.addFeature(shapePt);

        classObj mapclass2 = new classObj(layer2);
        mapclass2.setName("TEST CLASS");
        styleObj style2 = new styleObj(mapclass2);
        style2.setOutlinecolor(new colorObj(0,0,255,2));
        style2.setColor(new colorObj(0,0,255,2));
        style2.setWidth(2);
        style2.setSize(20);
        style2.setAngle(0);
        style2.setAntialias(0);
        style2.setSymbolname("CrossGeometryV");

        map.setSize(600, 600);
        map.setExtent(0, 0, 300, 300);
        map.setTransparent(mapscriptConstants.MS_OFF);
        map.selectOutputFormat("PNG"); 

        /* Saves map file  */
        map.save(OUT_PATH + MAP_FILE_OUT);
 
        /* Saves image */
        map.draw().save(OUT_PATH + IMAGE_OUT,map);


Hope someone can help this beginner


Matt Cross
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060906/1647065a/attachment.html


More information about the mapserver-users mailing list