Hi Yatendra, layer.close(); , here layer is the base layer. The code that I have provided is used to colour features in the layer (You can change the entire layer color also). The layer has many features, which can be retrieved using shapeObj shape = layer.getFeature(shapeInd, -1); "shapeInd" is the index of the shape.
This is the shape that i use to add into the temporary layer created oTempLayer.addFeature(shape); So, once I add the shape that I want to color to the temporary layer, I close the base layer using layer.close(); I hope this helps. Regards, Sucharita > On Thu, May 8, 2008 at 11:09 AM, <[EMAIL PROTECTED]> wrote: > Dear Sucharita, > I have one more question. U have used > "oTempLayer.addFeature(shape);" > > How to get shape? > > Which layers shape are you talking about? Please clarify my doubt. > I am newbie to asp.net mapserver. > Thanks Regards > Yatendra Jaiswal > > Sucharita Samuel wrote: > > > > 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 <[EMAIL PROTECTED]> > > 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 > >> [email protected] > >> http://lists.osgeo.org/mailman/listinfo/mapserver-users > >> > > > > _______________________________________________ > > mapserver-users mailing list > > [email protected] > > http://lists.osgeo.org/mailman/listinfo/mapserver-users > > > > > Quoted from: > > http://www.nabble.com/How-TO-change-color-of-a-layer-using-mapscript%28without-editing-mapfile%29-tp16983974p17100215.html > >
_______________________________________________ mapserver-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapserver-users
