[mapguide-users] Update Line Feature Class

akram akram at gsg-eg.com
Wed May 21 04:28:10 EDT 2008


Hi Kenneth, Hi All, 


I would like to create new Line (MgFeatureGeometricType.Curve) Layer , and 
create line feature in this new Layer , I worked with follwoing steps: 


1.Take Layer Definition for Exsisting Line Layer and SetResource as 
following 


MgByteReader byteReader = resourceService.GetResourceContent(layerDefResId);
XmlDocument doc = new XmlDocument();
String xmlLayerDef = byteReader.ToString();
doc.LoadXml(xmlLayerDef);
String xmlString = doc.DocumentElement.OuterXml;
MgResourceIdentifier layerDefId = new MgResourceIdentifier("Session:" + 
GetParameter(this.args, "SESSION") + "//NewLayer.LayerDefinition");
resourceService.SetResource(layerDefId, new MgByteReader(xmlString, 
"text/xml"), null); 

 

2. Insert New Layer 


layers.Insert(layers.IndexOf(layer), newLayer); 

 

3.Create Line Geometry 


MgLinearRing Line = geometryFactory.CreateLinearRing(coordinateColl);
MgGeometry Geom = geometryFactory.CreatePolygon(Line, null); 


4.Write Geometry and Update Featur Service 


propertyValues.Add(new MgGeometryProperty("Geometry", byteReader1));
updateCommands.Add(new MgInsertFeatures(className, propertyValues));
MgFeatureService featureService = 
(MgFeatureService)this.site.CreateService(MgServiceType.FeatureService);
featureService.UpdateFeatures(layerResId, updateCommands, false); 


5. Save map and refresh 


after previouse steps No thing appear , No bugs , No Result , Only NewLayer 
Created 

 

Can you help me plz to update Exsisting Line Layer ? 


Best Regards 

Akram
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20080521/627c00b2/attachment.html


More information about the mapguide-users mailing list