Advertisement
tftftf

Untitled

Dec 15th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. x = np.linspace(xx[0,0],xx[623,1287],num=1288)
  2. y = np.linspace(yy[0,0],yy[623,1287],num=624)
  3. hlines = [((x1, yi), (x2, yi)) for x1, x2 in zip(x[:-1], x[1:]) for yi in y]
  4. vlines = [((xi, y1), (xi, y2)) for y1, y2 in zip(y[:-1], y[1:]) for xi in x]
  5. grid = list(polygonize(MultiLineString(hlines + vlines)))
  6. poly_grid = gpd.GeoDataFrame({'geometry':grid})
  7. test = gpd.sjoin(pipelines, poly_grid, op='intersects')
  8.  
  9. test.head()
  10.  
  11. geometry    index_right
  12. 0   LINESTRING (-117.149389922 33.41909344100003, ...   264022
  13. 0   LINESTRING (-117.149389922 33.41909344100003, ...   264021
  14. 0   LINESTRING (-117.149389922 33.41909344100003, ...   264020
  15. 0   LINESTRING (-117.149389922 33.41909344100003, ...   264019
  16. 0   LINESTRING (-117.149389922 33.41909344100003, ...   263395
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement