Infrastructure Map Server Developer

Infrastructure Map Server Developer

Posts: 3
Registered: ‎06-25-2008
Message 1 of 1 (118 Views)

Polygon Digitize Issue

118 Views, 0 Replies
07-28-2008 04:00 AM
Hi All,

I am trying to Digitize a polygon and add it to existing Featuresource in mapguide 2009. I could able to digitize the polygon and add it usingFeatureService-->UpdateFeature. But I could not able to see the polygon added to the layer. Anybody please help me where i am doing mistake. Following is the code

string coordData = txtCat.Text;
coordData = coordData.Substring(0, coordData.Length - 1);
Array coord = coordData.Split(',');

for (int i = 0; i < coord.Length - 1; i++)
string xyVal = (string)coord.GetValue(i);
string[] xy = xyVal.Split(' ');
double pX = Convert.ToDouble ( xy.GetValue(0).ToString ());
double pY = Convert.ToDouble(xy.GetValue(1).ToString());


MgUserInformation UserInfo = new MgUserInformation(wsSession);
MgSiteConnection siteConn = new MgSiteConnection();
MgResourceService wsRSService = (MgResourceService)(siteConn.CreateService(MgServiceType.ResourceService));
//MgMappingService wsMap = (MgMappingService)(siteConn.CreateService(MgServiceType.MappingService));
MgFeatureService wsFeatService = (MgFeatureService)(siteConn.CreateService(MgServiceType.FeatureService));
//string mapRes = "Library://India/Hyderabad/Floor_1/Data/WS.FeatureSource";
//MgResourceIdentifier mgMapRes = new MgResourceIdentifier(mapRes);
//map = new MgMap();
//map.Create(wsRSService, mgMapRes, "Floor1_Map");


string wsFeatSource = "Library://Australia/Perth/Floor_1/Data/WS.FeatureSource";

MgResourceIdentifier wsRSIdentifier = new MgResourceIdentifier(wsFeatSource);
Boolean featSourceExist = false;
featSourceExist = DoesResourceExist(wsRSIdentifier, wsRSService);
if (featSourceExist)
MgPropertyCollection propColl = new MgPropertyCollection();
MgStringProperty strProp = new MgStringProperty("NAME", "POLY A");

MgWktReaderWriter wkReadWrite = new MgWktReaderWriter();
MgAgfReaderWriter agfReadWrite = new MgAgfReaderWriter();

MgLinearRing pExterior = geomFact.CreateLinearRing(polyData);

MgPolygon newPoly = geomFact.CreatePolygon (pExterior,null);

MgByteReader byteReader = agfReadWrite.Write(newPoly);

propColl.Add (new MgStringProperty ("Test","Test" ));

propColl.Add (new MgGeometryProperty ("SHPGEOM",byteReader));

MgFeatureCommandCollection featCmd = new MgFeatureCommandCollection();
featCmd.Add (new MgInsertFeatures ("Poly",propColl ));
wsFeatService.UpdateFeatures(wsRSIdentifier, featCmd, false);




Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.