[Qgis-developer] Expression based labeling

Sandro Santilli strk at keybit.net
Fri Oct 28 03:15:41 EDT 2011


On Thu, Oct 27, 2011 at 09:46:11AM -0300, Martin Dobias wrote:
> On Thu, Oct 27, 2011 at 5:28 AM, Nathan Woodrow <madmanwoo at gmail.com> wrote:
> > Thanks Andreas. Glad you like it.
> >>> Question 1: the output preview of the label does not seem to work when I
> >>> use a field - is there something I need to >>do to enable it? I would expect
> >>> it to pull in the first record or some random record to retrieve values?
> >
> > Ah yes there seems to be a bug with grabbing the first record with some data
> > sources.  I get the top feature using layer.featureAt(0) but for some reason
> > not all providers return a record at this index.  Writing a patch now.
> 
> That is because not all data providers use ids in interval [0,N-1].
> For example, postgres provider uses the column with primary key as ID
> - so the values may be arbitrary. It is better to do a select()
> followed by just one nextFeature().

Would it make sense to abstract provider-specific IDs so that the
[0, N-1] range holds for everyone ?

--strk; 

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html


More information about the Qgis-developer mailing list