Auflistung aller Funktionen, die in der virtuellen Schicht von QGIS verfügbar sind
Wie kann ich automatisch eine Liste aller Funktionen erhalten, die für die Verwendung in der virtuellen Schicht von QGIS verfügbar sind?
Nach meinem eigenen Verständnis / meiner Erfahrung und der QGIS-Dokumentation verwendet die virtuelle Schicht von QGIS eine Mischung aus Funktionen, die in PostGIS , SQLite , SpatiaLite und den Funktionen von QGIS-Ausdrücken bereitgestellt werden . (Ich hoffe, ich habe nichts Wichtiges verpasst.)
Ich habe mehrere Themen gesehen. Welche räumlichen Funktionen stehen Shapefiles als „virtuelle Ebenen“ in QGIS DB Manager zur Verfügung? und virtuelle Ebenen für QGIS (GitHub) , leider konnte ich in keiner von ihnen die Lösung für mein Problem finden.
Antworten
Sie können mit Python-Introspektion und gut formatierten QGIS-Python-Modulen direkt auf die virtuellen Ebenen zugreifen, wobei der folgende Code in der QGIS-Konsole ausgeführt wird:
from db_manager.db_plugins.vlayers import sql_dictionary
print(f"Functions: {sql_dictionary.functions}")
print(f"Math functions: {sql_dictionary.math_functions}")
print(f"String functions: {sql_dictionary.string_functions}")
print(f"Aggregate functions: {sql_dictionary.aggregate_functions}")
print(f"Spatialite functions: {sql_dictionary.spatialite_functions}")
print(f"QGIS functions: {sql_dictionary.qgis_functions}")
Ergebnisse in:
Functions: ['changes', 'coalesce', 'glob', 'ifnull', 'hex', 'last_insert_rowid', 'nullif', 'quote', 'random', 'randomblob', 'replace', 'round', 'soundex', 'total_change', 'typeof', 'zeroblob', 'date', 'datetime', 'julianday', 'strftime']
Math functions: ['Abs', 'ACos', 'ASin', 'ATan', 'Cos', 'Cot', 'Degrees', 'Exp', 'Floor', 'Log', 'Log2', 'Log10', 'Pi', 'Radians', 'Round', 'Sign', 'Sin', 'Sqrt', 'StdDev_Pop', 'StdDev_Samp', 'Tan', 'Var_Pop', 'Var_Samp']
String functions: ['Length', 'Lower', 'Upper', 'Like', 'Trim', 'LTrim', 'RTrim', 'Replace', 'Substr']
Aggregate functions: ['Max', 'Min', 'Avg', 'Count', 'Sum', 'Group_Concat', 'Total', 'Var_Pop', 'Var_Samp', 'StdDev_Pop', 'StdDev_Samp']
Spatialite functions: ['*iszipblob', '*ispdfblob', '*isgifblob', '*ispngblob', '*isjpegblob', '*isexifblob', '*isexifgpsblob', '*geomfromexifgpsblob', 'MakePoint', 'BuildMbr', '*buildcirclembr', 'ST_MinX', 'ST_MinY', 'ST_MaxX', 'ST_MaxY', 'ST_GeomFromText', '*pointfromtext', '*geomfromwkb', '*pointfromwkb', 'ST_AsText', 'ST_AsBinary', '*assvg', '*asfgf', '*geomfromfgf', 'ST_Dimension', 'ST_GeometryType', 'ST_Srid', 'ST_SetSrid', 'ST_isEmpty', 'ST_isSimple', 'ST_isValid', 'ST_Boundary', 'ST_Envelope', 'ST_X', 'ST_Y', 'ST_StartPoint', 'ST_EndPoint', 'ST_Length', 'ST_isClosed', 'ST_isRing', 'ST_Simplify', '*simplifypreservetopology', 'ST_NumPoints', 'ST_PointN', 'ST_Centroid', 'ST_PointOnSurface', 'ST_Area', 'ST_ExteriorRing', 'ST_InteriorRingN', 'ST_NumGeometries', 'ST_GeometryN', 'MbrEqual', 'MbrDisjoint', 'MbrTouches', 'MbrWithin', 'MbrOverlaps', 'MbrIntersects', 'MbrContains', 'ST_Equals', 'ST_Disjoint', 'ST_Touches', 'ST_Within', 'ST_Overlaps', 'ST_Crosses', 'ST_Intersects', 'ST_Contains', 'ST_Relate', 'ST_Distance', 'ST_Intersection', 'ST_Difference', 'ST_Union', 'ST_SymDifference', 'ST_Buffer', 'ST_ConvexHull', 'ST_Transform', '*initspatialmetadata', '*addgeometrycolumn', '*recovergeometrycolumn', '*discardgeometrycolumn', '*createspatialindex', '*creatembrcache', '*disablespatialindex', '*checkspatialmetadata', '*autofdostart', '*autofdostop', '*initfdospatialmetadata', '*addfdogeometrycolumn', '*recoverfdogeometrycolumn', '*discardfdogeometrycolumn', '*filtermbrwithin', '*filtermbrcontains', '*filtermbrintersects', '*buildmbrfilter']
QGIS functions: ['atan2', 'round', 'rand', 'randf', 'clamp', 'scale_linear', 'scale_exp', '_pi', 'to_int', 'toint', 'to_real', 'toreal', 'to_string', 'tostring', 'to_datetime', 'todatetime', 'to_date', 'todate', 'to_time', 'totime', 'to_interval', 'tointerval', 'regexp_match', 'now', '_now', 'age', 'year', 'month', 'week', 'day', 'hour', 'minute', 'second', 'day_of_week', 'title', 'levenshtein', 'longest_common_substring', 'hamming_distance', 'wordwrap', 'regexp_replace', 'regexp_substr', 'concat', 'strpos', '_left', '_right', 'rpad', 'lpad', 'format', 'format_number', 'format_date', 'color_rgb', 'color_rgba', 'ramp_color', 'color_hsl', 'color_hsla', 'color_hsv', 'color_hsva', 'color_cmyk', 'color_cmyka', 'color_part', 'darker', 'lighter', 'set_color_part', 'point_n', 'start_point', 'end_point', 'nodes_to_points', 'segments_to_lines', 'make_point', 'make_point_m', 'make_line', 'make_polygon', 'x_min', 'xmin', 'x_max', 'xmax', 'y_min', 'ymin', 'y_max', 'ymax', 'geom_from_wkt', 'geomFromWKT', 'geom_from_gml', 'relate', 'intersects_bbox', 'bbox', 'translate', 'buffer', 'point_on_surface', 'reverse', 'exterior_ring', 'interior_ring_n', 'geometry_n', 'bounds', 'num_points', 'num_interior_rings', 'num_rings', 'num_geometries', 'bounds_width', 'bounds_height', 'is_closed', 'convex_hull', 'sym_difference', 'combine', '_union', 'geom_to_wkt', 'geomToWKT', 'transform', 'uuid', '_uuid', 'layer_property', 'var', '_specialcol_', 'project_color']