[Qgis-developer] Adding Attributes to Vector Layor (QGIS 0.9.1)

nathan leverington nleverin at gmail.com
Sun Feb 17 19:14:42 EST 2008


Hi all,

Im new qgis and gis in general so sorry for the newbie question.

im currently having a problem with adding attributes to the vector layor.

Im using qgis 0.9.1 development libraries and creating my own application
using Open Suse 10.3.  I was following Tim Sutton tutorial 6 to implement
this but have noticed that QgsFeatureAttribute class has been removed from
the 0.9.1 release.

I have changed the the tutorial code:

*    while ((mypFeature = mypProvider->getNextFeature**(true)))
    {
      //get the attributes of this feature
      const std::vector < QgsFeatureAttribute >& myAttributes =
mypFeature->attributeMap();

      for (int i = 0; i < myAttributes.size(); i++)*


with the following:

*    //now iterate through each feature
    while (mypProvider->getNextFeature(mypFeature))
    {
      //get the attributes of this feature
      // const std::vector < QgsFeatureAttribute >& myAttributes =
mypFeature->attributeMap();
      const QgsAttributeMap& myAttributes = mypFeature.attributeMap();

      if( myAttributes.isEmpty() ) cout << "attribute map is empty " <<
endl;*


Iv tried replacing the  QgsFeatureAttribute with the QgsAttributeMap, but
when calling the attributeMap() function i do not seem to be pulling in the
attribute data.

Is this a problem with the shapefile datastore.  (i.e. i am using the same
source shapefile data that was used for Tim's tutorial 6)

thanks in advance,

nlev.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20080218/75a1a748/attachment.html


More information about the Qgis-developer mailing list