[MAPSERVER-USERS] How TO change color of a layer using mapscript(without editing mapfile)
Sucharita Samuel
iworktech.sucharita at gmail.com
Wed May 7 01:45:17 PDT 2008
Hi Yatendra,
To change the colour of a layer, you can create a
temporary layer, assign the attributes (like color,outline color etc) and
then add the shape to your existing layer and redraw the map image..
The following code might help,
//*************Code for creating a temporary layer to be added onto the
existing map******
layerObj oTempLayer = new layerObj(map);
oTempLayer.type = MS_LAYER_TYPE.MS_LAYER_POLYGON;
oTempLayer.status = 1;
classObj oTempClass = new classObj(oTempLayer);
labelObj oLabel = oTempClass.label;
oLabel.color.setRGB(0,0,0);
styleObj oStyle = new styleObj(oTempClass);
oStyle.outlinecolor.setRGB(100, 12, 12);
oStyle.color.setRGB(221, 160, 221);
oTempLayer.addFeature(shape);
layer.close();
oImg = map.draw();
int i= oTempLayer.draw(map, oImg);
//*********************************************************************************
Regards,
Sucharita
On Fri, May 2, 2008 at 12:18 PM, yatendra <yatendra.jaiswal at gmail.com>
wrote:
>
> Hi
> Thanks for reply
> i tried this code but there is null reference in
> "$style->color->setRGB( 255, 0, 0 );
> $style->outlinecolor->setRGB( 255, 0, 0 );"
> this step....
> Please giude me...
> color of a layer is not schanging
>
> Thanks Regards
>
>
> yatendra wrote:
> >
> > Hi friends,
> > I am using asp.net to develop application on mapserver.
> > I want to change layer color available in my mapfile.
> > Is it possible to change layer color without editing layer in mapfile?
> > What function do i need to use to do this?
> > Can i give unique value to each feature?
> > Is it also possible?
> > Please reply if any one know regarding this.
> > any idea will also be helpful to me...
> > Thanks regards
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-TO-change-color-of-a-layer-using-mapscript%28without-editing-mapfile%29-tp16983974p16997022.html
> Sent from the Mapserver - User mailing list archive at Nabble.com.
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080507/d2ff0f69/attachment.htm>
More information about the MapServer-users
mailing list