[Qgis-user] Antw: Loading custom-functions in own projekt

Kai Behncke Kai.Behncke at ibbenbueren.de
Mon Mar 18 08:13:45 PDT 2019


Allright, I found the error:

First, I had a "NON-Ascii"-String in my funtion:

def winkelKonvertierung(wert,feature,parent):
  if 'DN' in wert: 
    neuerParameter='Ø '+wert
  else:
    neuerParameter=wert
    
    neuerParameter=neuerParameter.replace('*','‰ ')
  return neuerParameter


...therefore I got an error by loading that function.
I got a solution by implementing:

# -*- coding: latin-1 -*-
import os, sys
from qgis.core import *
from qgis.gui import *
@qgsfunction(args='auto', group='Custom')
...and then that functiion....



Mit freundlichen Grüßen
Im Auftrag

Kai Behncke
Geoinformation
Tel.: +49 5451 931-7125

E-Mail: kai.behncke at ibbenbueren.de 

Rathaus II
Roncallistraße 3-5
1. Stock, Raum 105
49477 Ibbenbüren



>>> "Kai Behncke" <Kai.Behncke at ibbenbueren.de> 18.03.2019 14:14 >>>
Dear users,

I use QGIS 3.6.
I have created a couple of custom functions in my Project. But each
time
I do a restart of Quantum GIS (at the next morning or so...), I first
need to activate these functions by the "load and save-Button" in the
function-editor.
Is there a way to integrate my custom-functions in my project
"directly" when I start my project?
Is it possible to load the file "my_custom_functions.py" somewhere in
my project so that I can use these functions each time I reopen my
project 
(without activating these functions by clicking the the "load and
save-Button" in the function-editor)?

Thank you very much, Kai

Mit freundlichen Grüßen
Im Auftrag

Kai Behncke
Geoinformation
Tel.: +49 5451 931-7125

E-Mail: kai.behncke at ibbenbueren.de 

Rathaus II
Roncallistraße 3-5
1. Stock, Raum 105
49477 Ibbenbüren



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20190318/adf2e010/attachment-0001.html>


More information about the Qgis-user mailing list