A few steps are involved: 1. Create a temporary featuresource 2. Create a temporary layer to display the features 3. Insert the temporary layer into the runtime map
The buffer files in the MapGuide viewer has template code for all three steps. All steps are explained in the Developer Guide (PDF version at least). You might also want to look here: http://trac.osgeo.org/mapguide/wiki/CodeSamples/ASP.Net/ScribbleApp Regards, Kenneth Skovhede, GEOGRAF A/S Galois skrev:
Hello, I´m trying to add a point to a map but I have no idea how to it. I have declare the map object, and also I create a point with it's coordinates. But I don't know what is the next step that I have to do... The code follows.... public partial class _Default : System.Web.UI.Page { public string sessionId; public string webLayout; protected void Page_Load(object sender, EventArgs e) { string physicalPath = @"C:\Program Files\MapGuideOpenSource\WebServerExtensions\www\webconfig.ini"; try { MapGuideApi.MgInitializeWebTier(physicalPath); passAndSession(); //Associate a session ID with the MgSiteConnection Object MgUserInformation userInfo_new = new MgUserInformation(sessionId); MgSiteConnection siteConnection = new MgSiteConnection(); siteConnection.Open(userInfo_new); MgResourceService resourceSrvc = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService); MgMap map = new MgMap(siteConnection); webLayout = "Library://GoSpatial/Web+Layouts/Autostrada+Brescia+Padova+Map.WebLayout"; MgResourceIdentifier resId = new MgResourceIdentifier("Library://GoSpatial/Maps/Italy Map.MapDefinition"); String mapName = resId.GetName(); MgResourceIdentifier mapStateId = new MgResourceIdentifier("Session:" + sessionId + "//" + mapName + "." + MgResourceType.Map); map.Create(resourceSrvc, resId, mapName); map.Save(resourceSrvc, mapStateId); map.Open(resourceSrvc, mapName); createPoint();}catch (Exception ex) { throw (ex); } } public string passAndSession() { MgUserInformation userInfo = new MgUserInformation("Administrator", "admin"); MgSite site = new MgSite(); site.Open(userInfo); sessionId = site.CreateSession(); return sessionId; } public MgPoint createPoint() { MgGeometryFactory geometryFactory = new MgGeometryFactory(); MgCoordinateXY coordinate = (MgCoordinateXY) geometryFactory.CreateCoordinateXY(10.913161, 45.408046); MgPoint point = geometryFactory.CreatePoint(coordinate); return point; } }
_______________________________________________ mapguide-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapguide-users
