#必须是u类型==================u==================== by gisoracle def dmstod(dms): #arcpy.AddMessage("======================gisoracle==========="+dms+"==============================") try: p = dms.find('°') if p<0: return str(dms) #arcpy.AddMessage("p="+str(p)) d=string.atof(dms[0:p].strip()) #arcpy.AddMessage("d="+str(d)) p1=dms.find('′') #arcpy.AddMessage("p1="+str(p1)) if p1<0: p1=dms.find("'") f=0 # if p1>0: f=string.atof(dms[p+1:p1].strip()) else: p1=p #arcpy.AddMessage("f="+str(f)) p2=dms.find('″') if p2<0: p2=dms.find('"') #arcpy.AddMessage("p2="+str(p2)) s=0 # if p2>0: s=string.atof(dms[p1+1:p2].strip()) else: s=string.atof(dms[p1+1:].strip()) #可以没有秒 #arcpy.AddMessage("s="+str(s)) return d+f/60+s/3600 except ValueError: return None