Looking for a way to have the geometry type in string and after a lot LOT of searching, finally found a clean method in the docs :
geomTypeString=qgis.core.QgsWkbTypes.displayString(int(layer.wkbType()))
that will give 'Point','LineString','Polygon','MultiPoint'.... and it "knows" all of the geometry types in Qgis.
For my purpose I still had some trouble with the 'Point25D' and other strange types so added this to restrict it to the flat ones (Point,Line,Poly)
geomFlatTypeString=qgis.core.QgsWkbTypes.displayString(int(
qgis.core.QgsWkbTypes.flatType(int(in_layer.wkbType()))))
For Info, the aim was a method that creates a memory layer duplicate of a layer whatever the type is, here is the full code:
def copyLayer(in_layer,condition=None):
#condition=function to test features and return True or False______
if condition==None:
def condition(f):
return True
typeGeom=qgis.core.QgsWkbTypes.displayString(int(
qgis.core.QgsWkbTypes.flatType(int(in_layer.wkbType()))))
crsId=in_layer.crs().authid()
out_layer=QgsVectorLayer(typeGeom+"?crs="+crsId,
in_layer.name()+"_copie",
"memory")
fields=in_layer.dataProvider().fields().toList()
out_layer.dataProvider().addAttributes(fields)
out_layer.updateFields()
features=[f for f in in_layer.getFeatures() if condition(f)]
out_layer.dataProvider().addFeatures(features)
return out_layer