[mapguide-trac] #173: .Net API for MapGuide 1.2 Beta2 cannot access layers

MapGuide Open Source trac_mapguide at osgeo.org
Fri May 25 08:35:10 EDT 2007


#173: .Net API for MapGuide 1.2 Beta2 cannot access layers
-------------------------+--------------------------------------------------
   Reporter:  ksgeograf  |       Owner:                             
       Type:  defect     |      Status:  new                        
   Priority:  medium     |   Milestone:  1.2                        
  Component:  General    |     Version:  1.2.0                      
   Severity:  major      |    Keywords:  API layers GetLayers Unpack
External_id:             |  
-------------------------+--------------------------------------------------
 using the following code:


 {{{
         MgSiteConnection con = new MgSiteConnection();
         con.Open(new MgUserInformation(sessionID));

         //get the map
         MgSite site = con.GetSite();
         MgResourceService rs =
 (MgResourceService)con.CreateService(MgServiceType.ResourceService);
         MgResourceIdentifier mapID = new MgResourceIdentifier("Session:" +
 sessionID + "//" + mapName + "." + MgResourceType.Map);
         MgMap map = new MgMap();
         map.Open(rs, mapID);

         //get a feature service
         MgFeatureService ftr =
 (MgFeatureService)con.CreateService(MgServiceType.FeatureService);

         MgLayerCollection colLayers = map.GetLayers();

 }}}


 The last line gives the following exception:


 {{{
 OSGeo.MapGuide.MgInvalidOperationException: The requested operation is
 invalid.
 - MgMapBase.GetLayers line 117 file
 c:\build_bond_area\mapguide_open_source_v1.2\build_13.7\mgdev\common\platformbase\MapLayer/MapBase.cpp
 - MgMap.UnpackLayersAndGroups line 640 file
 c:\build_bond_area\mapguide_open_source_v1.2\build_13.7\mgdev\common\mapguidecommon\MapLayer/Map.cpp
 --- End of inner exception stack trace ---
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/mapguide/ticket/173>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals


More information about the mapguide-trac mailing list