Infrastructure Map Server Forum
Welcome to Autodesk’s Infrastructure Map Server Forums. Share your knowledge, ask questions, and explore popular Infrastructure Map Server topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MapGuidel 2011 API Cannot Edit, Update or Delete features

1 REPLY 1
Reply
Message 1 of 2
neeedo7
581 Views, 1 Reply

MapGuidel 2011 API Cannot Edit, Update or Delete features

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.

1 REPLY 1
Message 2 of 2
jackie.ng
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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report