intersects. Alternatively, if segment is part of MultiLineString inside a polygon (no matter if LineString of MultiLineString) overlay intersection might help as you suggested.
intersection, I think?
# one (multi)linestring and a set of polygons l = LineString([(-1, -1), (1, 1), (2, 2), (3, 4), (5, 5)]) polys = geopandas.GeoSeries([box(0, 0, 4, 1), box(0, 1, 4, 3), box(0,3,4,4)]) # plot them together ax = polys.plot(cmap='viridis') geopandas.GeoSeries([l]).plot(color='red', linewidth=3, ax=ax) # creating multiple linestrings split per polygon res = polys.intersection(l) # illustrate result ax = polys.plot(cmap='viridis', alpha=.5) res.plot(linewidth=3, cmap='Set1', ax=ax)
intersection, pretty cool!
hello, I have a problem with importing geopandas package, I have created my new environment in Conda and I the installation has done but in jupyter book doesn t work
and the error Command "python setup. py egg_info" failed with error code 1 in C so I have noticed that it's not in the same path I mean the same environment which is normal that it could not do it, so how can I change the environment in jupyter book just to import geopandas and the same time not lose all my packages in Conda because I have found already trouble with pysal package and I don't want they have the same issue
nearest spatial join-feature with an example and a first implementation of the function that gives an idea how the function could work: geopandas/geopandas#1096