[mapguide-users] SelectFeatures using SetFilter gives null exception

Tony techswami at hotmail.com
Fri Aug 22 18:13:15 EDT 2008


Hi 
i am using the following code to find the   Pipes that are greater than 12' 
i am getting null exeception 
the sample code in dev guide is the same. why i am getting error
anyone

thanks
tony

MgUserInformation userInfo = new MgUserInformation(mgSessionId);
            MgSiteConnection siteConnection = new MgSiteConnection();
            siteConnection.Open(userInfo);

            MgResourceService resourceService =
siteConnection.CreateService(MgServiceType.ResourceService) as
MgResourceService;
            MgFeatureService featureService =
siteConnection.CreateService(MgServiceType.FeatureService) as
MgFeatureService;
            
            MgFeatureQueryOptions districtQuery = new
MgFeatureQueryOptions();
            districtQuery.SetFilter("Size > 12");
            
            MgMap map = new MgMap();
            map.Open(resourceService, "General Public Map");
            MgLayer layer = map.GetLayers().GetItem("SD") as MgLayer;
           
            MgFeatureReader featureReader =
layer.SelectFeatures(districtQuery);
//getting error here 
            featureReader.ReadNext();
            
            MgByteReader districtGeometryData =
featureReader.GetGeometry("Geometry");
            MgAgfReaderWriter agfReaderWriter = new MgAgfReaderWriter();
            MgGeometry districtGeometry =
agfReaderWriter.Read(districtGeometryData);
-- 
View this message in context: http://n2.nabble.com/SelectFeatures-using-SetFilter-gives-null-exception-tp777204p777204.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list