[Qgis-developer] Expression based labeling

Marco Hugentobler marco.hugentobler at sourcepole.ch
Fri Oct 28 03:25:32 EDT 2011


>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 ?


Even then, it would still be necessary to do select() followed by 
nextFeature() as Martin recommended. Because there are some providers 
without ramdom feature access (only sequential iteration through the 
features). Examples are 'delimited text' or 'gpx'.

Regards,
Marco


On 28.10.2011 09:15, Sandro Santilli wrote:
> 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
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer



More information about the Qgis-developer mailing list