[mapguide-users] selectionXML Problem

Zac Spitzer zac.spitzer at gmail.com
Thu Jan 13 20:15:33 EST 2011


what datasources are you using?

what are the data types of your primary keys?

I've seen issues with 2.2 RC2 and doubles

http://trac.osgeo.org/mapguide/wiki/MapGuideRfc43

z


On Fri, Jan 14, 2011 at 11:08 AM, Greg <gbneff at cid.utah.gov> wrote:
>
> I am having trouble getting the current selection by using GetSelectionXML(),
> passing the selection XML to the server and getting the selection.  When a
> new item is selected for about 90% of the features, I get the correct Item.
> For the other 10%, the item is not found, even though the correct properties
> are shown in the properties pane.  I am using the basic layout.  Below is my
> code that takes the XML and gets the item from the Mapguide server.  Any
> ideas what might be happening?
>
> <%
>    String sessionId = Request.Form.Get("SID");
>    String selectionXML = Server.UrlDecode(Request.Form.Get("sel"));
>    //Response.Write("sessionId: " + sessionId + "<br>selectionXML:  " +
> selectionXML);
>
>    string realPath = Request.ServerVariables["APPL_PHYSICAL_PATH"];
>    String configPath = realPath + "webconfig.ini";
>    MapGuideApi.MgInitializeWebTier(configPath);
>
>    MgUserInformation userInfo = new MgUserInformation(sessionId);
>    MgSiteConnection siteConnection = new MgSiteConnection();
>    siteConnection.Open(userInfo);
>    if (siteConnection == null)
>    {
>        Response.Write("Failed to get site connection.");
>        return;
>    }
>
>    MgResourceService resService =
> (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
>    MgFeatureService featureService =
> (MgFeatureService)siteConnection.CreateService(MgServiceType.FeatureService);
>
>    MgMap map = new MgMap();
>    map.Open(resService, "Cid_Map");
>
>    //get LineID information for selected feature (line)
>    MgSelection selection = new MgSelection(map, selectionXML);
>    MgLayer layer = (MgLayer)map.GetLayers().GetItem("lines_ss_cid");
>    string strLayerClassName = layer.GetFeatureClassName();
>    string strSelection = selection.GenerateFilter(layer,
> strLayerClassName);
>    MgFeatureQueryOptions nameQuery = new MgFeatureQueryOptions();
>    nameQuery.SetFilter(strSelection);
>    MgResourceIdentifier resID = new
> MgResourceIdentifier("Library://data/sdf/lines_ss_cid.FeatureSource");
>    MgFeatureReader featureReader = featureService.SelectFeatures(resID,
> "lines_ss_cid", nameQuery);
>    string strLineID = "";
>    if(featureReader.ReadNext())
>        {
>            strLineID = featureReader.GetInt32("LineID").ToString();
>        }
>    else
>        {
>            //this shouldn't happen
>            Response.Write("LineID not found in Mapguide datasource.");
>        }
> --
> View this message in context: http://osgeo-org.1803224.n2.nabble.com/selectionXML-Problem-tp5920249p5920249.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>



-- 
Zac Spitzer
Solution Architect / Director
Ennoble Consultancy Australia
http://www.ennoble.com.au
http://zacster.blogspot.com
+61 405 847 168


More information about the mapguide-users mailing list