[mapguide-users] SelectFeatures using SetFilter gives null
exception
Jackie Ng
jumpinjackie at gmail.com
Fri Aug 22 18:53:06 EDT 2008
I see nothing indicating what feature class you are querying from. The fact
that you are calling SelectFeatures() from the MgLayer instead of the
MgFeatureService means that you need to new the MgMap object with the
MgSiteConnection as indicated here:
http://trac.osgeo.org/mapguide/wiki/MapGuideRfc9
- Jackie
Tony wrote:
>
> 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-tp777204p777266.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list