[QGIS-Developer] How to Add Custom QGIS Model Programmatically

Ismail Sunni imajimatika at gmail.com
Tue May 28 09:41:29 PDT 2019


HI Luigi,

Thanks for the pointer, it's really helpful. Now I got my model registered
:)

I convert it to Python script first, then add it as you said.

Next, I will check if it's working properly

Best regards

On Tue, May 28, 2019 at 5:52 PM Luigi Pirelli <luipir at gmail.com> wrote:

>
> I'm travelling, but iIRC, you need before register model provider in
> processing... There are processing tests about alg provider registry.
> On Tuesday, 28 May 2019, Ismail Sunni <imajimatika at gmail.com> wrote:
>
>> Dear QGIS developers,
>>
>> Currently, I am trying to create a Docker image based on QGIS official
>> docker image to run a custom processing model. I am able to run the
>> existing processing model by using a python script.
>>
>> Unfortunately, for a custom model, I need to register the model first
>> (similar to adding a new model in QGIS toolbox) before I can use it. I try
>> some ways to do it:
>>
>>    1. Trying to find Python API to do it. I couldn't find it (perhaps I
>>    missed it)
>>    2. Trying to add/copy manually the model file to the model directory.
>>    Unfortunately, in the container doesn't even have any profile directory.
>>    3. I tried to find the model directory path, but I can't find it from
>>    QSettings (it returns empty setting with *QSettings.allKeys()*)
>>    4. I tried to manually create the directories based on my machine
>>    model directory location, but it's not working also.
>>
>> Any suggestions for this problem? A Python API to add/register the model
>> would be a perfect solution.
>>
>> Thanks
>>
>> --
>> Ismail Sunni
>> ismailsunni.wordpress.com
>>
>
>
> --
>
> Luigi Pirelli
>
>
> **************************************************************************************************
> * LinkedIn: https://www.linkedin.com/in/luigipirelli
> * Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
> * GitHub: https://github.com/luipir
> * Mastering QGIS 2nd Edition:
> *
> https://www.packtpub.com/big-data-and-business-intelligence/mastering-qgis-second-edition
> * Hire me: http://www.qcooperative.net
>
> **************************************************************************************************
>
>

-- 
Ismail Sunni
ismailsunni.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190528/7585a7e0/attachment.html>


More information about the QGIS-Developer mailing list