Thank You Very Much Kenneth I got it....... Kenneth Skovhede, GEOGRAF A/S writes:
Hello Akram. What you do here, is essentially copy a map's xml definition. Your step 1 is the same as calling resourceService.CopyResource(layerDefResId, layerDefId). I can't see where your "newLayer" variable comes from (the one you insert). 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. 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.
Step 3 looks OK.
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. If step 3 and 4 are completed, a refresh of the map should display your new feature. Perhaps the coordinates are misplaced, so the feature is inserted outside the map? If you have access to MapGuide Studio, you can preview your feature source, and see the actual data rows. With that, you can verify that there is an added row. Regards, Kenneth Skovhede, GEOGRAF A/S
akram skrev:
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 ------------------------------------------------------------------------
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to