返回Django中的距离对象



我的功能很小,因此:

from django.contrib.gis.measure import Distance
def RailTest(mod_ewdim, mod_ewspacing, cols): 
    y = Distance(inch=mod_ewspacing)
    x = Distance(inch=mod_ewdim)
    z = Distance(inch=3)
    l = ( (x*cols)+(y*(cols-1)) )+z
    return l

但是,当我调用该函数时,我进行type(l)时,它是类型float的。我如何确保返回距离对象。

任何帮助。

您是否尝试过以下操作?

return Distance(inch=l)

您尝试过

是否尝试过
return Distance(inch=l)

最新更新