Infrastructure Map Server Developer

Infrastructure Map Server Developer

New Member
Posts: 1
Registered: ‎02-19-2009
Message 1 of 2 (346 Views)

MapGuidel 2011 API Cannot Edit, Update or Delete features

346 Views, 1 Replies
05-16-2011 01:19 AM


I have a problem editing features in Mapguide 2011 using the API in C# with

The map displays fine in the browser, but  whenever I try to delete or update a parcel, nothing is changed. Also I can’t add a new parcel. No exceptions or errors appear, and I believe the code is also correct.

I referenced all the correct aspx pages in the layout in Mapguide Studio and all 2011 dlls in the application.

I don’t know what’s wrong and why is it that the map doesn’t update or reflect these changes.


Is there something missing that I should configure to Edit the features using Mapguide 2011?

I'm connecting using an anonymous user.

Here's the code for deleting:


  public bool RemoveSelectedParcels(string selectString)
        //Please type in the code between the comments
        MgResourceService resService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
        MgFeatureService featService = (MgFeatureService)siteConnection.CreateService (MgServiceType.FeatureService);

        MgMap map = new MgMap(siteConnection);
        map.Open(resService, "Sheboygan");

        //MgLayer layer = getLayerByName(map, "Parcels");
        MgLayer layer = map.GetLayers().GetItem("Parcels") as MgLayer;
        MgFeatureCommandCollection commands = new MgFeatureCommandCollection();
        commands.Add(new MgDeleteFeatures("Parcels", selectString));
        MgResourceIdentifier resId = new MgResourceIdentifier("Library://Exercise/Data/Parcels.FeatureSource");

        featService.UpdateFeatures(resId, commands, false);

    return true;



Attached is the Exercise that I was trying to implement. It was originally done using Mapguide 2007.

But I'm trying to implement it on Mapguide 2011.

Valued Mentor
Posts: 284
Registered: ‎10-06-2008
Message 2 of 2 (311 Views)

Re: MapGuidel 2011 API Cannot Edit, Update or Delete features

06-15-2011 10:19 PM in reply to: neeedo7

Firstly, try the code with an Administrator login. If that works then it's because generally speaking, Anonymous users are denied write acess to Library-based resources, and denied access to write features to Library-based feature sources. This is because Anonymous is the lowest privilege MapGuide user account.


- Jackie

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.