Skip to content

Why LineString can't be splitted to 2 parts? #1781

Closed Answered by forestbat
forestbat asked this question in Q&A
Discussion options

You must be logged in to vote

Now I use a new method to solve this problem:

def line_min_dist(gpd_node_df: GeoDataFrame, gpd_line_df: GeoDataFrame):
    gpd_min_line_df = gpd.sjoin_nearest(gpd_node_df, gpd_line_df, 'left')
    gpd_min_line_df = gpd_min_line_df.loc[~gpd_min_line_df.index.duplicated()]
    index_right = gpd_min_line_df['index_right'].to_numpy()
    origin_geom_array = gpd_line_df.geometry.to_numpy()
    geom_array = np.delete(origin_geom_array, index_right)
    for index in range(0, len(gpd_node_df)):
        point = gpd_node_df.geometry[index]
        right = index_right[index]
        pre_near_point = sure_nearest_point(point, origin_geom_array[right])
        line = LineString([point, pre_near_point]…

Replies: 2 comments 16 replies

Comment options

You must be logged in to vote
16 replies
@forestbat
Comment options

@brendan-ward
Comment options

@forestbat
Comment options

@brendan-ward
Comment options

@forestbat
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by forestbat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants