Feature Readers

A feature reader, represented by an MgFeatureReader object, is used to iterate through a list of features. Typically, the feature reader is created by selecting features from a feature source.

To create a feature reader, use the MgFeatureService::SelectFeatures() method. See Selecting with the Web API for details about selection.

To process the features in a feature reader, use the MgFeatureReader::ReadNext() method. You must call this method before being able to read the first feature. Continue calling the method to process the rest of the features.

The MgFeatureReader::GetPropertyCount() method returns the number of properties available for the current feature. When you know the name and type of the feature property, call one of the MgFeatureReader::GetPropertyType() methods (where PropertyType represents one of the available types) to retrieve the value. Otherwise, call MgFeatureReader::GetPropertyName() and MgFeatureReader::GetPropertyType() before retrieving the value.