Infrastructure Map Server Developer

Infrastructure Map Server Developer

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

MapGuidel 2011 API Cannot Edit, Update or Delete features

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

Hi,

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

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
jackie.ng
Posts: 282
Registered: ‎10-06-2008
Message 2 of 2 (309 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
Need installation help?

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