[Qgis-developer] New Vector API

Matthias Kuhn matthias.kuhn at gmx.ch
Fri Jan 4 15:07:33 PST 2013


Hi Martin,

On 01/04/2013 10:19 PM, Martin Dobias wrote:
> Hi Matthias
>
> thanks for your mail.
>
> On Thu, Jan 3, 2013 at 10:37 AM, Matthias Kuhn <matthias.kuhn at gmx.ch> wrote:
>> You've been talking about updating to PyQt4 SIP version 2. I noticed this
>> change did not yet happen. What are your plans regarding this update?
> Yes, the plans are still there. I'm only wondering what would be the
> best time to switch - right now within the branch or a bit later once
> the branch is merged and the new code settles down a bit? I can see a
> slight advantage of the latter approach of having a greater chance of
> separating problems caused by the merge and problems caused by the SIP
> API change, but I do not have a strong opinion here.
I think doing it now would be the best time, as the API is already and 
is even more going to be broken. For plugin devs it will probably be the 
easiest to take care only once. No strong opinion here either.
>> I'm also looking forward to seeing QgsFeatureRequest support QgsExpression,
>> I think this is not yet supported?
> No, it's not yet supported. It should be possible to add features like
> this one easily even later without breaking any API. It is not my
> priority now, of course any contributions in that direction are
> welcome! (and also for support of native expressions for postgres,
> spatialite and other DBMSs)
Maybe I find the time to take care of this.
What I would like to see (but I think that's a rather tough one): to 
make the providers translate QgsExpression to native backend commands. 
Although this can lead to some nasty side-effects.

>> PS:
>> I've just been able to segfault:
>>
>> a = dataProvider.getFeatures( QgsFeatureRequest().setFilterFid( featureId )
>> )
>> a.rewind()
>> a.next()
> Which provider was that? Just tried with OGR and memory providers and it worked.
>
>
>> PPS:
>> Another strange thing (maybe related), calling next() directly on a fid
>> filter returns a feature, storing into a QgsFeatureIterator and calling next
>> on this throws a StopIteration:
>>
>> dataProvider.getFeatures(QgsFeatureRequest().setFilterFid( featureId )
>> ).next()
>> <qgis.core.QgsFeature object at 0xaa027a0>
>>
>> features = dataProvider.getFeatures(QgsFeatureRequest().setFilterFid(
>> featureId ) )
>> f = features.next()
>> Traceback (most recent call last):
>>    File "/home/kk/.qgis//python/plugins/remotedebug/pysrc/pydevd_exec.py",
>> line 2, in Exec
>>      exec exp in global_vars, local_vars
>>    File "<console>", line 1, in <module>
>> StopIteration
> Again, works for me correctly with OGR and memory provider - maybe
> some provider other has that problem.
Both tests have been made with a postgres backend.

>
> Regards
> Martin
Regards
Matthias


More information about the Qgis-developer mailing list