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(Mg
MgFeatureService featService = (MgFeatureService)siteConnection.CreateService (MgServiceType.FeatureService);
MgMap map = new MgMap(siteConnection);
//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/Parc
featService.UpdateFeatures(resId, commands, false);
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.
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.
Access a broad range of knowledge to help get the most out of your products and services.
Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.
Upgrading to a 2015 product? Make sure to check these out 1st!