在double for loop Python中搜索geoJson的更有效方法

在double for loop Python中搜索geoJson的更有效方法,python,for-loop,geojson,shapely,Python,For Loop,Geojson,Shapely,通过geoJson文件在double for循环中搜索最有效的方法(或python方法)是什么 我想找出开始或结束坐标等于点坐标的线串。我的意思是,我需要首先遍历点文件,然后遍历线字符串文件,若坐标相等,则将其转储到新的geojson文件中 您可以在下面看到我的代码: for j, feature2 in enumerate(nav['features']): if feature2['properties']['gp'] in ('RTE', 'RTB', 'RTA'):

通过geoJson文件在double for循环中搜索最有效的方法(或python方法)是什么

我想找出开始或结束坐标等于点坐标的线串。我的意思是,我需要首先遍历点文件,然后遍历线字符串文件,若坐标相等,则将其转储到新的geojson文件中

您可以在下面看到我的代码:

for j, feature2 in enumerate(nav['features']):
    if feature2['properties']['gp'] in ('RTE', 'RTB', 'RTA'):
        for i, feature in enumerate(tra['features']):                
            segment = LineString(
                [Point(feature['geometry']["coordinates"][0]), Point(feature['geometry']["coordinates"][1])])
            if Point(poi) != Point(segment.coords[0]) and Point(poi) != Point(segment.coords[1]):
                continue
之后,我用这些点做一些计算,并将它们转储到新文件中

我的点文件包含~10k和线字符串文件~90k对象,现在处理需要一天多的时间。 我发现了,但对我来说似乎没有效果

我会很感激任何关于如何使这个过程更加优雅和高效的想法