简体   繁体   English

在两点之间的直线上找到点的坐标?

[英]Find coordinate of point on a straight line between two points?

How can I code a script in python for the following problem?如何在 python 中为以下问题编写脚本? I have starting and ending coordinates of a straight line.我有一条直线的起点和终点坐标。 I want to find coordinate of a point with a given distance from the starting point.我想找到距起点给定距离的点的坐标。

Excel中输入数据的屏幕截图

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.

相关问题 找到曲线上的两个点/导数,它们之间的线是直线/恒定的 - Find two points/derivatives on curves between which the line is straight/constant 使用 QPainterPath 在两点之间绘制直线 - Drawing straight line between two points using QPainterPath 如何在给定线的另一个点和垂直线上的2个点的线上找到点的X坐标? - How to find the X coordinate of a point on a line given another point of the line and the 2 points on a perpendicular line? 点和线之间的距离(从两点开始) - Distance between point and a line (from two points) 在不知道第二个坐标的情况下获得直线上的点/像素 - Get points/pixels in a straight line without knowing second coordinate 如何找到直线和曲线状二维点集的交点? - How to find the intersection points of a straight line and a curve-like set of two dimensional points? 通过两点画线,而不是在两点之间画线(在对数刻度上,但仍然是一条直线) - Drawing line through two points, instead of between (on a log scale, but still a straight line) 查找点和多边形之间的最长“直线”路径 - Find longest “straight” path between Point and Polygon 如何在3D中找到圆上两个点之间的点? - How to find the point between two points on a circle in 3D? 计算球坐标中两点之间的距离 - Calculate distance between two points in spherical coordinate
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM