<div dir="ltr"><div>Hi,</div><div><br></div><div>I'm trying to create/prototype a custom QgsVectorDataProvider in Python to retrieve data from a HTTP REST API.</div><div><br></div><div>When testing, I do the following to register my provider:</div><div><br></div><div>

<div style="color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Consolas,"Courier New",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(0,0,255)">from</span><span style="color:rgb(0,0,0)"> qgis.core </span><span style="color:rgb(0,0,255)">import</span><span style="color:rgb(0,0,0)"> QgsProviderRegistry, QgsProviderMetadata
</span><div style="color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Consolas,"Courier New",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(0,0,255)">from</span><span style="color:rgb(0,0,0)"> provider </span><span style="color:rgb(0,0,255)">import</span><span style="color:rgb(0,0,0)"> MyProvider</span>
</div></div><div style="color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Consolas,"Courier New",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(0,0,0)">registry = QgsProviderRegistry.instance()</span>
</div></div><div style="color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Consolas,"Courier New",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(0,0,0)">metadata = QgsProviderMetadata(<span style="color:rgb(0,0,0)">MyProvider</span>.providerKey(), <span style="color:rgb(0,0,0)">MyProvider</span>.description(), MyProvider.createProvider)</span>
</div></div><div style="color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Consolas,"Courier New",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(0,0,0)">registry.registerProvider(metadata)</span>
</div></div>
<div style="color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Consolas,"Courier New",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(0,0,0)">layer = QgsVectorLayer(</span><span style="color:rgb(163,21,21)"><my-url></span><span style="color:rgb(0,0,0)">, </span><span style="color:rgb(163,21,21)">'Test myprovider'</span><span style="color:rgb(0,0,0)">, </span><span style="color:rgb(163,21,21)">'myprovider-plugin'</span><span style="color:rgb(0,0,0)">)
</span><div style="color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Consolas,"Courier New",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(0,0,0)">QgsProject.instance().addMapLayer(layer)</span></div></div></div></div>
This seems to initialize the provider, although it stops after the constructor of <span style="color:rgb(0,0,0)">MyFeatureIterator(QgsAbstractFeatureIterator)</span> is run.</div><div>For this test, data is retrieved from the REST API in the constructor, and I can see in the logs that the data is retrieved.<br></div><div><br></div><div>I expected it to start iterating objects, but the next message in the log is <span style="color:rgb(0,0,0)">prepareSimplification (I have added a log message to every class method to watch progress in the logs), then nothing.</span></div><div><span style="color:rgb(0,0,0)"><br></span></div><div><span style="color:rgb(0,0,0)">I even installed qgis-dev and watched the logs using </span>Microsoft's DebugViewer, but I could not see any relevant information.</div><div><br></div><div>Could someone please help me or tell me where to look to solve this issue and start iterating with <span style="color:rgb(0,0,0)">nextFeature</span>/fetchFeature?

Regards,</div><div>Mats Taraldsvik
</div><div>







</div></div>

</div></div>