<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hello Akram.<br>
<br>
What you do here, is essentially copy a map's xml definition. Your step
1 is the same as calling resourceService.CopyResource(layerDefResId,
layerDefId).<br>
I can't see where your "newLayer" variable comes from (the one you
insert).<br>
<br>
If you already have a layer, it is much easier to include it in the
map, but keep it invisible. Then turn it on when you want to display
it. That would remove step 1 and 2.<br>
You only have to create a copy of the layer if you want to modify it
for the current session. If you want the layer to display another
feature source, you must update the xml in step 1.<br>
<br>
Step 3 looks OK.<br>
In step 4, I think you have used the id of the layerdefinition, rather
than the id of the featuresource. I am not sure you can do that.<br>
<br>
If step 3 and 4 are completed, a refresh of the map should display your
new feature.<br>
Perhaps the coordinates are misplaced, so the feature is inserted
outside the map?<br>
If you have access to MapGuide Studio, you can preview your feature
source, and see the actual data rows. <br>
With that, you can verify that there is an added row.<br>
<br>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
akram skrev:
<blockquote cite="mid:20080521082830.7301CE00417@lists.osgeo.org"
 type="cite">Hi Kenneth, Hi All,
  <br>
  <p>
  </p>
  <p>I would like to create new Line (MgFeatureGeometricType.Curve)
Layer , and create line feature in this new Layer , I worked with
follwoing steps:
  </p>
  <p></p>
  <p>1.Take Layer Definition for Exsisting Line Layer and SetResource
as following
  </p>
  <p></p>
  <p>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);
  </p>
  <p></p>
  <p></p>
  <p>2. Insert New Layer
  </p>
  <p></p>
  <p>layers.Insert(layers.IndexOf(layer), newLayer);
  </p>
  <p></p>
  <p></p>
  <p>3.Create Line Geometry
  </p>
  <p></p>
  <p>MgLinearRing Line =
geometryFactory.CreateLinearRing(coordinateColl);
MgGeometry Geom = geometryFactory.CreatePolygon(Line, null);
  </p>
  <p></p>
  <p>4.Write Geometry and Update Featur Service
  </p>
  <p></p>
  <p>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);
  </p>
  <p></p>
  <p>5. Save map and refresh
  </p>
  <p></p>
  <p>after previouse steps No thing appear , No bugs , No Result , Only
NewLayer Created
  </p>
  <p></p>
  <p></p>
  <p>Can you help me plz to update Exsisting Line Layer ?
  </p>
  <p></p>
  <p>Best Regards
  </p>
  <p>Akram
  </p>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>
  </pre>
</blockquote>
</body>
</html>