Strangely, I sometime do this: $mySel = $sel->ToXml(); $this->originalSel = $mySel;
and I find that works better.. On Wed, May 17, 2023 at 2:17 PM David Bowen <dbowen...@gmail.com> wrote: > Our application has functionality where a user can search for an address > and then click on a button to return data, when available, from a selection > of layers. We're encountering an issue where there is data present, however > when the user clicks the button, MapGuide returns an error saying no valid > objects are selected. If the user clicks the button a second time, results > are returned. This seems like a MapGuide error and I've been attempting to > troubleshoot it without success. > This issue is intermittent and only seems to exist in our Development > environment, however I can recreate it if I export the Development package > from Maestro and import it into another environment. > > The relevant section of code that seems to be failing is: > > $myMap = $this->MapGuideObject->getMap(); > $session = $this->mgSessionId; > $mapName = $this->mgMapID; > $objkeys = ''; > $errorMsg = null; > $siteConnection = $this->MapGuideObject->getSiteConnection(); > // Get an instance of the Resource and Mapping Services and use them to > open > // the map and initialize a selection object. > $resourceSrvc = $this->MapGuideObject->getResourceService(); > $featureSrvc = $this->MapGuideObject->getFeatureService(); > //Get selected map layers. > $sel = new MgSelection( $myMap ); > > $sel->Open( $resourceSrvc, $mapName ); > > $this->originalSel = $sel->ToXml(); > $selLayers = $sel->GetLayers(); > //Check to see if no objects are selected. > > It appears that the line $this->originalSel = $sel->ToXml(); is the issue > as there are times where it returns data but other times it's an empty > string. Has anyone encountered an issue like this, or would anyone have an > idea of how to resolve it? > Alternatively, what would be the best way to try to catch a potential > MapGuide error that is being generated? I believe that we have all error > logging turned on but nothing has appeared in the log files. > > Thanks, > David > _______________________________________________ > mapguide-users mailing list > mapguide-users@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/mapguide-users >
_______________________________________________ mapguide-users mailing list mapguide-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapguide-users