Infrastructure Map Server Developer

Infrastructure Map Server Developer

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

MapGuidel 2011 API Cannot Edit, Update or Delete features

345 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 (310 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
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!