[英]Find coordinate of point on a straight line between two points?
May be this might help you.可能这可能会帮助你。 I had converted the coordinates into polar coordinates,
我已将坐标转换为极坐标,
import pandas as pd
import re
df = pd.DataFrame({"Start_Northing": ["41°10'23"],"Start_Easting":["61°26'24"],"End_Northing":["41°10'42"],
"End_Easting": ["61°27'00"]})
def dms2dd(s):
degrees, minutes, seconds = re.split('[°\'"]+', s)
dd = float(degrees) + float(minutes)/60 + float(seconds)/(60*60)
return dd
for column in df.columns:
df['New_'+ str(column)] = df[column].apply(dms2dd)
df['point Easting'] = df[["New_End_Northing", "New_End_Easting"]].apply(tuple, axis=1)
df["point Northing'"] = df[["New_Start_Northing", "New_Start_Easting"]].apply(tuple, axis=1)
df = df.drop(['New_Start_Northing','New_Start_Easting','New_End_Northing','New_End_Easting'],axis=1)
print(df.to_string())
The result is,结果是,
Start_Northing Start_Easting End_Northing End_Easting point Easting point Northing'
0 41°10'23 61°26'24 41°10'42 61°27'00 (41.17833333333333, 61.45) (41.17305555555555, 61.44)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.