[mapserver-users] C# mapscript: create features programmatically

Pietro Giannini pgiannini at bytewise.it
Wed Nov 19 06:13:31 EST 2008


Ciao list.

Anyone knows how to add dynamically a feature in a layer, working in
cshap_mapscript?

I must to add programmatically this features, without adding them to the
layer source.

Following code don't works... i.e. the new feature is not showing
(map is a valid MapObject, shp a valid ShapeObject, "kriging" is a valid
layer name, type of layer and kind of shape is line)


            layerObj kl = map.getLayerByName("kriging");
            kl.addFeature(shp);
            imageObj imgMap = map.draw();
            string fname = Guid.NewGuid().ToString();
            string imgpath = map.web.imagepath + @"\" + fname + ".jpg";
            if (File.Exists(imgpath)) File.Delete(imgpath);
            imgMap.save(imgpath, map);


many thanks for your help.
ciao   ..............................................pg


-- 
Pietro Giannini
Bytewise srl - Area GIS
41°50'38.58"N 12°29'13.39"E



More information about the mapserver-users mailing list